Shadowheart411
Shadowheart411

Reputation: 25

Why am I getting the "Fail" response?

I’m wracking my brain to see what I did here. No matter what, I get the fail print out at the end of the code. I know I'm missing something simple but what? Please help.

import random as rand
import time
count = 0

name = input("What is your name? ")
welcome_statement = print( "Welcome,", name, ",to the games!")
rpsls = input("Ready to begin? [Y/N] ").lower()
if rpsls == "Y":
    rules = input("Are you familiar with the rules? [Y/N] ")
    if rules == "Y":
        print ("Starting...")
        time.sleep(3)
        comp_action = ["rock", "paper", "scissors", "lizard", "spock"]
        user_input = input( 'Take a guess: ')
        if user_input == comp_action:
            print("TIE")
else:
    print("Fail")

Upvotes: 0

Views: 32

Answers (1)

AfterFray
AfterFray

Reputation: 1851

Remove .lower() as following :

name = input("What is your name? ")
welcome_statement = print( "Welcome,", name, ",to the games!")
rpsls = input("Ready to begin? [Y/N] ")
if rpsls == "Y":
    rules = input("Are you familiar with the rules? [Y/N] ")
    if rules == "Y":
        print ("Starting...")
        time.sleep(3)
        comp_action = ["rock", "paper", "scissors", "lizard", "spock"]
        user_input = input( 'Take a guess: ')
        if user_input == comp_action:
            print("TIE")
else:
    print("Fail")

OR, change .lower() to .upper() as following :

name = input("What is your name? ")
welcome_statement = print( "Welcome,", name, ",to the games!")
rpsls = input("Ready to begin? [Y/N] ").upper()
if rpsls == "Y":
    rules = input("Are you familiar with the rules? [Y/N] ")
    if rules == "Y":
        print ("Starting...")
        time.sleep(3)
        comp_action = ["rock", "paper", "scissors", "lizard", "spock"]
        user_input = input( 'Take a guess: ')
        if user_input == comp_action:
            print("TIE")
else:
    print("Fail")

Upvotes: 1

Related Questions