I have some code where I'd like to use the inputted username again in another def, but it doesn't generate anything. I get a username with the following code without issues (s_print is a slow print for reference):
def input_username():
username = input()
user = username
s_print('Hello {}!'.format(user))
return user
input_username()
Then I have a def a bit later on in the code with various if statements:
def options_input():
if option == '1': etc.
elif option == 'Bye':
end_user = input_username()
s_print('Goodbye {}!.'.format(end_user))
else: etc.
options_input()
I want to get the username inputted in def input_username to be reprinted in the def options_input elif option == 'Bye' but it just generates blank with no error code/message, like it's looping continuously through code. What is going wrong?
Aucun commentaire:
Enregistrer un commentaire