Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions

Question

Describe why intercultural communication competence is a necessity

Answered: 1 week ago

Question

8. Managers are not trained to be innovation leaders.

Answered: 1 week ago