forked from crantz007/capstoneProject1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfinalPythonGame.py
More file actions
41 lines (39 loc) · 1.05 KB
/
Copy pathfinalPythonGame.py
File metadata and controls
41 lines (39 loc) · 1.05 KB
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
38
39
40
41
#Rock_Paper_Scissors
import random
# input
player = input("Enter your choice (rock/paper/scissors): ")
player = player.lower()
# computing and exceptions
while ( player != "rock" and player != "paper" and player != "scissors"):
print(player)
player = input("That choice is not valid. Enter your choice (rock/paper/scissors): ")
player = player.lower()
cpu = random.randint(0, 2)
if (cpu == 0):
computer = "rock"
elif (cpu == 1):
computer = "paper"
elif (cpu == 2):
computer = "scissors"
else:
computer = "Error"
if (player == computer):
print("Draw!")
elif (player == "rock"):
if (computer == "paper"):
print("Computer wins!")
else:
print("You win!")
elif (player == "paper"):
if (computer == "rock"):
print("You win!")
else:
print("Computer wins!")
elif (player == "scissors"):
if (computer == "rock"):
print("Computer wins!")
else:
#output
print("You win!")
print("Your choice: " + player + "\nComputer choice: " + computer + "\nThank you for playing!")
input('press any key to quit:')