-
Notifications
You must be signed in to change notification settings - Fork 0
/
RPS.py
37 lines (32 loc) · 1.15 KB
/
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
32
33
34
35
36
37
#making a rock paper scissors game.
first_person = input("First players name: ")
second_person = input("Second players name: ")
def check(player1, player2):
if player1 != "Rock" and player1 != "Paper" and player1 != "Scissors":
print("You did not enter rock, paper or scissors. Please try again.\n")
elif player2 != "Rock" and player2 != "Paper" and player2 != "Scissors":
print("You did not enter rock, paper or scissors. Please try again.\n")
def game(player1, player2):
if player1 == player2:
print("It's a draw. Please try again.\n")
elif player1 == "Rock":
if player2 == "Scissors":
print(first_person + " wins!\n")
else:
print(second_person + " wins:\n")
elif player1 == "Paper":
if player2 == "Scissors":
print(second_person + " wins!\n")
else:
print(first_person + " wins!\n")
elif player1 == "Scissors":
if player2 == "Rock":
print(second_person + " wins!\n")
else:
print(first_person + " wins!\n")
while True:
player1 = str(input("Rock, Paper or Scissors?\n"))
player2 = str(input("Rock, Paper or Scissors?\n"))
check(player1, player2)
game(player1, player2)
break