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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started