Jan-15-2019, 02:41 AM
I have a couple questions about the command "def". Once you define something, say "greeting", and you write your script in it:
def greeting(): name = input('What's your name?') print('Hi,', name.title()) age = input('How old are you?') if age > 18: print('Nice.')So you define greeting, but you want to continue that outside of the "def" command, like:
greeting() else: print('Oh')Can I continue a "if then" statement outside of defining a variable? Also, I use "greeting somewhere, after python has run the script, will it continue down the script? Say I want to go to a specific spot of code depending on how the user input is answered, how would I do that? Thanks