Hello everyone, I need some guidance on some basic stuff. Been trying to find an answer but it's been hard to find.
This is what I'm trying to do, I'm trying to use if statements to go from one function to another. I'm use to using "goto" statements but
I know those just make messy code and aren't really used from what I read. Below is an example
I want to make it so if they don't answer y or n that they will be returned to the beginning but if they answer y or n that they will be moved
to the next function with the next set of instructions. How would I do this?
thank you again everyone :)
This is what I'm trying to do, I'm trying to use if statements to go from one function to another. I'm use to using "goto" statements but
I know those just make messy code and aren't really used from what I read. Below is an example
I want to make it so if they don't answer y or n that they will be returned to the beginning but if they answer y or n that they will be moved
to the next function with the next set of instructions. How would I do this?
thank you again everyone :)
def user(): command = input("Please enter y for cookies, n for cupcakes > ") if command == "y": print("Here are your cookies") elif command == "n": print("Here are your cupcakes") else: print("Please enter y or n for your selection") return cookies() def cookies(): print("testing") user() cookies()