0

Why won't this compile correctly? Python

I am trying to make a game in python. However, when I compile this it says that game isn't defined. can anyone help? if user_resp == str("start"): game() else: print ("b") def game(): print("you wake up in a room with two doors") print("which door will you choose?") print ("left or right") user_resp == raw_input if user_resp == str("left"): print ("you chose the left door") elif user_resp == str("right"): print ("you chose the right door") else: print ("that wasnt an option....")

12th Oct 2017, 4:55 PM
Stef
Stef - avatar
1 Odpowiedź
+ 6
You have to define the method *before* you call it.
12th Oct 2017, 5:00 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar