Question: It needs to be written in Python. I'm having a really hard time with this. I've written the whole program but every value I enter
It needs to be written in Python.


I'm having a really hard time with this. I've written the whole program but every value I enter it says "invalid choice". please help.
This is what I have done:
def PrintPurpose(): print("Please choose from the menu.") print("============================") print("1: Draw a single bar of symbol") print("2: Print numbers from n to m") print("3: Draw a rectangle") print("4: Draw a right triangle") print("5: Quit") print("============================")
def DarBar(symbol,length): for i in range(0,length): print()
def PrintSequence(n,m): if n def PrintRectangle(symbol,width,height): for i in range(0,height): for j in range(0,width): print(symbol) print() print() def PrintTriangle(symbol,height): for i in range(0,height): for j in range(0,i+1): print(symbol) print() print() def main(): while True: PrintPurpose() choice = input(print("Enter your choice: ") if choice == 1 symbol = raw_input("Enter the symbol for bar") length = input("Enter the length of the bar") DrawBar() elif choice == 2: n = input("Enter first bound") m = input("Enter second bound") PrintSequence(n,m) elif choice == 3: symbolR = raw_input("Enter the symbol for rectangle") widthR = input("Enter the width of the rectangle") heightR = input("Enter height of the rectangle") PrintRectangle(symbolR, widthR, heightR) elif choice == 4: symbolT = raw_input("Enter the symbol for triangle") heightT = input("Enter height of the triangle") PrintTriangle(symbolT, heightT) elif choice == 5: return else: print( choice, "is an invalid choice")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
