'''The expected input and output are given ( see right side ) but my output and my code ( on the left ) did not match, what seems to be the problem? Thank you! 0 and a>0 and b>a and (b-a)%2==0): #if...



'''The expected input and output are given (see right side) but my output and my code (on the left) did not match, what seems to be the problem? Thank you!



1 while(True):<br>b=int(input(0 and a>0 and b>a and (b-a)%2==0): #if valid input break; print("Invalid input"); #for upper part 5 6 #exit from loop 7 #if Invalid input print and continue in loop 8 4 9 vfor n in range (0, (b-a)//2): 2 10 #for spaces Your Output for spaces in range (0,b-n): print (" ",end=""); 11 12 Enter b: Enter a: Invalid input 13 #for stars Enter b: Enter a: for star in range (0,2*n+1): print ("*",end=""); print(); #for middle part 14 *a* 15 *aaa* 16 17 18 level=1; 19 vfor n in range ( (b-a)//2,b-a+1): Expected Output Enter b: Enter a: Invalid input. 20 #for spaces Enter b: Enter a: for spaces in range (0,b-n): print (" ",end=""); #for stars for star in range (0, (b-a)//2): 21 22 *a* 23 *aaa* 24 ******* 25 print("*",end=""); #for characters 26 for char in range (0,2*level-1): print ("a", end=""); level+=1; #for ending stars for star in range (0, (b-a)//2): print ("*",end=""); print(); #for lower part 27 28 29 30 31 32 33 34 35 for n in range (b-a+1,b): #for spaces for spaces in range (0,b-n): print (" ",end=""); 36 37 38 39 #for stars for star in range (0,2*n+1): print ("*",end=""); print(); 40 41 42 "/>
Extracted text: 1 while(True): b=int(input("Enter b: ")); a=int(input("Enter a: ")); #infinite loop #input b #input a Your code did not pass this test case. 4 Input if(b>0 and a>0 and b>a and (b-a)%2==0): #if valid input break; print("Invalid input"); #for upper part 5 6 #exit from loop 7 #if Invalid input print and continue in loop 8 4 9 vfor n in range (0, (b-a)//2): 2 10 #for spaces Your Output for spaces in range (0,b-n): print (" ",end=""); 11 12 Enter b: Enter a: Invalid input 13 #for stars Enter b: Enter a: for star in range (0,2*n+1): print ("*",end=""); print(); #for middle part 14 *a* 15 *aaa* 16 17 18 level=1; 19 vfor n in range ( (b-a)//2,b-a+1): Expected Output Enter b: Enter a: Invalid input. 20 #for spaces Enter b: Enter a: for spaces in range (0,b-n): print (" ",end=""); #for stars for star in range (0, (b-a)//2): 21 22 *a* 23 *aaa* 24 ******* 25 print("*",end=""); #for characters 26 for char in range (0,2*level-1): print ("a", end=""); level+=1; #for ending stars for star in range (0, (b-a)//2): print ("*",end=""); print(); #for lower part 27 28 29 30 31 32 33 34 35 for n in range (b-a+1,b): #for spaces for spaces in range (0,b-n): print (" ",end=""); 36 37 38 39 #for stars for star in range (0,2*n+1): print ("*",end=""); print(); 40 41 42
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here