Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import *
- choices = {"rock", "paper", "scissors"}
- userChoice = input("Enter rock, paper or scissors: ")
- if userChoice != "rock" and userChoice != "paper" and userChoice != "scissors":
- print("Invalid choices! Please enter rock, paper or scissors.")
- else:
- computerIndex = randint(0, 2)
- computerChoice = choices[computerIndex]
- print("Computer chose: " + computerChoice)
- if userChoice is (computerChoice):
- print("It`s a tie!")
- elif userChoice is "rock" and computerChoice is "scissors" or
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement