Question: I have copied my code here how will I break the loop if the user inputs the wrong number. def main(): print(Program to print out

I have copied my code here how will I break the loop if the user inputs the wrong number.

def main(): print("Program to print out the letter 'A' in various sizes.") n = int(input("Enter an odd number between 3 and 21: "))

while (n<3 or n>21): if (n<3): print("Error: n must be >= 3, not ",n) else: print("Error: n must be <= 3, not ",n) if n%2 == 0: n = n + 1 print((" " * n) + "^")

for horizontalLine in range(1, n): for j in range(n-horizontalLine, 0, -1): print(" ",end="") print("/",end="") if (horizontalLine == int(n/2)): for k in range(0, n-2): print("_", end="") print("\\")

main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!