Nov-09-2019, 10:54 AM
Hi I am trying to print out a string that shows the menu item selected in a function. I have the following code. But it is seems I don't have the logic correctly. Any suggestions?
def showMenu(): print ("\nExample menu") print ("-----------------") print ("1) File deletion") print ("2) File creation") print ("3) Exit\n") data=int(input("Enter your choice: ")) return data data = showMenu() while data!=3: user=showMenu() if data==1: print("Files deleted") elif datat==2: print("Files created") elif user==3: print("Exiting") else: print("'%s' is an unknown option."%user)