sports_talk = False
sports = ["Basketball", "Football", "Soccer"]
sports_response = ["What sports do you play?", "what sports do you play?"]
hobbies = ["Programming", "Playing Sports", "Art", "Singing", "Playing the Piano", "Watching YouTube"]
def what_question_hobby(questions):
choice = random.choice(hobbies)
if choice == "Playing Sports":
sports_talk = True
print(sports_talk)
print("Bot: " + choice)
if sports_talk == True:
print("/hint ask him what sports he plays")
info = input("You: ")
if info in sports_response:
print("Bot: " + random.choice(sports))
sports_talk = False
while True:
talking_input = input("You: ")
if talking_input == "What do you enjoy?":
what_question_hobby(talking_input)
I keep getting this error, but I am unsure how to fix it UnboundLocalError: local variable 'sports_talk' referenced before assignment on line 56