0

Tried making a rock paper scissors game i failed

so to learn python I was making a rock paper scissors game that detects user input put I'm not sure how I can detect this user input does anyone help me



def play():
 while input("Would you like to play rock paper scissors (Y/N)").upper() == "Y":
    main()

def main():
    userinput = while input("Rock Paper Or Scissors: ").upper()
        if userinput == "rock":
            print("User Used Rock")
        elif userinput == "paper":
            print("User Used Paper")
        elif userinput == "scissors":
            print("User Used Scissors")
        else:
            print("Invalid Option")

if __name__ == "__main__":
    play()
    
  • Try removing while and upper in userinput, and better to use lower instead – alim91 Apr 30 '21 at 21:13
  • remove the world "while" from getting your user input, and then dont compare an upper case input to lowercase words. – Sayse Apr 30 '21 at 21:13
  • Most of all, you need to repeat your Python tutorials, to learn how the basic statements work. You're close, but your conflation of `while input` shows that you need another run through at least an example or two. Asking us to teach you how to write an `input` statement is out of scope. Please repeat [on topic](https://stackoverflow.com/help/on-topic) and [how to ask](https://stackoverflow.com/help/how-to-ask) from the [intro tour](https://stackoverflow.com/tour). – Prune Apr 30 '21 at 21:22

1 Answers1

0

I don't know why you have a random while in your input statement.

userinput = input("Rock Paper Or Scissors: ").upper()

Instead, use the above.

Also you usually call main in your

if __name__ == "__main__": 
    main()
Buddy Bob
  • 5,829
  • 1
  • 13
  • 44