Skip to content

Instantly share code, notes, and snippets.

@calthoff
Created April 21, 2020 00:10
Show Gist options
  • Select an option

  • Save calthoff/cc7e957d7f8615ee6cae3a0e6ea84f14 to your computer and use it in GitHub Desktop.

Select an option

Save calthoff/cc7e957d7f8615ee6cae3a0e6ea84f14 to your computer and use it in GitHub Desktop.
import random
rps_dict = {"rock": "scissors", "paper": "rock", "scissors": "paper"}
rps = input("please type rock, paper, or scissors \n")
computer_choice = random.choice(list(rps_dict.keys()))
if rps == computer_choice:
print("You both picked {} it is a tie!".format(rps))
elif rps_dict[rps] == computer_choice:
print("You picked {} and the computer picked {}. You win!".format(rps, computer_choice))
else:
print("You picked {} and the computer picked {}. You lose!".format(rps, computer_choice))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment