0

I was trying to make a yes no system for a game that could choose dialogue options really simply without having to copy paste into elif hell. But the function won't change the variable to run it properly.

def YN():
   yn = input() 
   if yn == 'yes':
      answer = 'yes':
   elif yn == 'no':
      answer = 'no': 
print("is this correct?")
YN()
if answer == 'yes':
   print('yes') 
else:
   print('no') 

I was expecting the var to be altered but it's useless as soon as the function ends.

0 Answers0