Mar-17-2021, 11:35 AM
It will be easier to read your code on this forum if you use /python tags as described here: BBCode
Your function
Your function
menu()
is going to return either an integer value or None
if the input is invalid. You could assign this value to a variable and then pass it to started()
, or you could pass it directly:# Assign the value returned by menu() to a variable and then call started() op = menu() started(op) # Pass the value returned by menu() directly started(menu())Also, to simplify your code in the menu function, you can do just a single comparison to determine if the input is what you expect before returning. (Note that your current code would throw an error if the user enters a non-integer value, by the way.)
if 1 <= option <=5: return option else: print("Invalid selection") return