Variable possibly unbound error

Question:
its says that my variable is possibly unbound

Current behaviour:
Whenever I get to the part of the code which uses that variable it stops because there is an error, it also does this for other

Desired behaviour
I want it to not be an error

Repl link:
https://replit.com/@maxpritchard2/First-Repl#main.py

code snippet
if ao == "park":
  park = input("you go to the park, what do you do? grass or playground ")

if park == "grass":
  print("you lay on the grass and the grass eats you, please restart")
if park == "playground":
  print("You go to the playground but you cant decide what to pay on?")

:wave: Hey @maxpritchard2, welcome to the community!

This error is because it uses the park variable outside of the park if statement. here’s some updated code:

if ao == "park":
  park = input("you go to the park, what do you do? grass or playground ")

  if park == "grass":
    print("you lay on the grass and the grass eats you, please restart")
  if park == "playground":
    print("You go to the playground but you cant decide what to pay on?")
    playground = input("slide or swings? ")
    
    if playground == "slide":
      print("as you exit the slide you get teleported to the backrooms and die. restart")
      exit()
      
    if playground == "swings":
      print("You sit on the swings and keep swinging until the sun sets. good job you won")
      exit()
  else:
    print("since you dont want to do to either of those options you die. please restart")
    exit()

#end of park scene

beach = input("you get to the beach, what do you do, swim or play with sand (sand) ")

if beach == "swim":
  print("You swim in the water and you get pulled to the depths of the ocean")
  print("you died, please restart :)")
  exit()

if beach == "sand":
  print("You play in the sand and you fall into a sand sink hole")
  print("as your eyes adust to the light you see a temple")
  temple = input("Do you enter? (yes or no) ")

else:
  print("since you dont want to do to either of those things you die. please restart ")
  exit()

if temple == "yes":
  print("You enter the temple and ")

if temple == "no":
  print("A monster comes and eats you. you died please restart :)")
  exit()