I was having trouble in a bigger project of mine where a function would not return user input even when using the return function. I created a smaller version to focus more on the problem, because it gives the same outcome without the unnecessary clutter in between.
It lets you input whatever you want, but when you try to print it or ask the shell (or terminal, I'm not really sure of the proper term for it) what the input equals, it just has empty quotations.
global user_input
user_input = ''
def broken_thing(user_input):
greeting = input('do you want to play? (y/n) ')
if greeting == 'y':
print ('alright!')
user_input = input ('type your word here: ')
return user_input
else:
print('okay then goodbye')
broken_thing(user_input)
print('your word is '+(user_input)+'.')
The current output 'your word is .'