Jul-28-2019, 06:32 AM
If you would do it this way
Define your functions to get parameters/arguments and RETURN variables that your other code need.
If you would change your last lines in your function levelone()
BUT, and now it´s your turn: What is the value of name if your function is exited before the user inputs his name and how can you solve that?
BTW: the amount of BREAKs in your code is not pythonic. Rethink this also.
# Start Game name = '' levelone() print(name)it would work BUT THIS VERY BAD CODE STYLE! DON`T DO IT THIS WAY! NEVER USE GLOBAL!
Define your functions to get parameters/arguments and RETURN variables that your other code need.
If you would change your last lines in your function levelone()
# global name # or DELETE this line name = input('your name: ') line = "Hello, {}, welcome to the Gryphon's den, do you remember from anything before you got here?".format(name) print(line) return nameand would then call this function like
name = levelone() print(name)this would provide you with the name the user inputted.
BUT, and now it´s your turn: What is the value of name if your function is exited before the user inputs his name and how can you solve that?
BTW: the amount of BREAKs in your code is not pythonic. Rethink this also.