How can i set a global variable to equal a user's input within a method? For example, I tried doing the following code but it does't work.
def ask_question(var, question):
global var
var = str(input(question))
ask_question(name, "what's your name?")
print("Welcome",name)
If I do something like this it works.
def ask_question(ques):
global name
name = str(input(ques))
ask_question("what's your name?")
print("Welcome",name)
but then i can't change the variable when calling the method. For example if I also want to ask the user's age etc.