When the program goes to level one, and the game begins, I input the correct answer, but it does not work. The answer to the first quote is "death". The if else statement is supposed to acquire the answer of the user, and, if it is correct, display a message and move on to the next level. However, it does not. It displays another message telling me I lost.
I don't understand what is going on, especially since the if else statement picks up whether or not the user wants to view the rules.
Just to be safe, I am going to write one last clarification in a more straightforward form.
When I input the correct answer on level one, and I know for a fact it is the correct answer, it does not display the congrats_message, but it displays the loss_message.
welcome_message = "Hello! Welcome to Quote Game by Chandler Morell!"
version = "0.0.1"
congrats_message = "Congratulations! You passed level one!"
loss_message = "Sorry. You did not succeed. One life has been lost."
win_game_message = "Congratulations! You won the game!"
lost_game_message = "You made it to the end, but you did not win. Give it another go!"
lives = 3
def game_won():
print("")
print(win_game_message)
def game_lost():
print("")
print(lost_game_message)
def update_lives():
global lives
lives = lives - 1
if lives is 0:
print("You have ran out of lives. Game over.")
game_lost()
exit(0)
def view_rules():
rules = ["1. Do not look up quotes online.", "2. You have three lives.",
"3. You will have three words to choose from.", "4. Type the WORD not the NUMBER"]
print("")
for i in rules:
print(i)
def ask_view_rules():
rules_answer = input("Would you like to view the rules? (y/n): ")
if rules_answer is "y":
view_rules()
else:
print("")
print("Okay, let's begin!")
def level_one():
print("Lives: ", lives)
print("We will start with an easy quote. Fill in the blank.")
print("")
choices = ["1. death", "2. torture", "3. nothing"]
for i in choices:
print(i)
print("")
choice = input("Give me liberty or give me _____! - Patrick Henry ")
if choice is "death":
print("")
print(congrats_message)
print("")
level_two()
else:
print("")
print(loss_message)
print("")
update_lives()
level_two()
def level_two():
print("-----------------------")
print("")
print("Lives: ", lives)
print("Welcome to level two!")
print("")
choices = ["1. stupidity", "2. wisdom", "3. nobody"]
for i in choices:
print(i)
print("")
choice = input("Knowledge speaks, but ______ listens. - Jimi Hendrix ")
if choice is "wisdom":
print("")
print(congrats_message)
print("")
level_three()
else:
print("")
print(loss_message)
print("")
update_lives()
level_three()
def level_three():
print("-----------------------")
print("")
print("Lives: ", lives)
print("")
print("Wow. I am impressed!")
print("")
print(welcome_message)
print("Version: " + version)
ask_view_rules()
print("")
print("We will now begin the game!")
print("")
level_one()