Skip to content

Instantly share code, notes, and snippets.

@DonNeuron
Last active March 24, 2022 18:18
Show Gist options
  • Select an option

  • Save DonNeuron/e405ceef63dac21b0200557223a4d166 to your computer and use it in GitHub Desktop.

Select an option

Save DonNeuron/e405ceef63dac21b0200557223a4d166 to your computer and use it in GitHub Desktop.
import random
score = 0
choice = ["rock","scissors","paper"]
x = random.choice(choice)
def rockpaperscissors():
print(score)
user1 = input("Choose rock, scissors or paper")
if (x == "rock" and user1 == "rock") or (x == "paper" and user1 == "paper") or (x == "scissors" and user1 == "scissors"):
print ("tie")
elif (x == "rock" and user1 == "paper") or (x == "scissors" and user1 == "rock") or (x== "paper" and user1 == "scissors"):
print ("you win")
score+=1
elif (x == "paper" and user1 == "rock") or (x == "scissors" and user1 == "paper") or (x == "paper" and user1 == "rock"):
print ("you lose")
score-=1
else:
print ("error, try again")
rockpaperscissors()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment