0

I've been working on a choose your own adventure-type game as my final project for a school assignment, but I noticed that boolean values don't work within functions, I've added some test code to show this:

tv = False
def defin():
    if if_stat == 'A':
        tv = True
if_stat = input("")
print(tv)                      #Before anything is done
defin()
print(tv)                      #Definition result
if if_stat == 'A':
    tv = True
print(tv)                      #If statement result

I don't see what's going wrong and I need these values to be changed by if statements within definitions for my project.

Omar Einea
  • 2,478
  • 7
  • 23
  • 35

0 Answers0