-
Notifications
You must be signed in to change notification settings - Fork 0
/
manual_rps.py
31 lines (25 loc) · 837 Bytes
/
manual_rps.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import random
def get_computer_choice():
comp_choice = random.choice(["rock","paper","scissors"])
return comp_choice
def get_user_choice():
choice = input("Rock, Paper or Scissors? : ")
return choice
def get_winner(user_choice,computer_choice):
if user_choice == "scissors" and computer_choice== "paper":
print("You won!")
elif user_choice == "rock" and computer_choice == "scissors":
print("You won!")
elif user_choice == "paper" and computer_choice == "rock":
print("You won!")
elif user_choice == computer_choice:
print("It is a tie!")
else:
print("You lost")
def play():
comp_choice = get_computer_choice()
print(comp_choice)
user_choice = get_user_choice()
print(user_choice)
get_winner(user_choice,comp_choice)
play()