Why can't I change the variable can_answer to False without getting this error? This is just some quick code I wrote.
import random
questions = ["What's 1+1?", "What's 2+2?"]
def question():
global can_answer
can_answer = True
print(random.choice(questions))
def ans(answer):
if can_answer:
if can_answer == 2 or 4:
print('correct')
else:
print('wrong')
can_answer = False
else:
print('no questions to answer')