Skip to content

Commit eec3c90

Browse files
authored
Merge pull request #1 from dashing-dev/dashing-dev-patch-1
Rock-paper-scissors
2 parents 7e4e2c4 + 968b096 commit eec3c90

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

rock-paper-scissors.py

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import random
2+
while True:
3+
choices = ["rock","paper","scissors"]
4+
computer = random.choice(choices)
5+
player = None
6+
7+
while player not in choices:
8+
player = input("rock, paper, scissors?:") .lower()
9+
print("invalid choice try again!")
10+
if player == computer:
11+
print("computer: ",computer)
12+
print("player: ",player)
13+
print("Tie!")
14+
15+
elif player == "rock":
16+
if computer == "paper":
17+
print("computer: ", computer)
18+
print("player: ", player)
19+
print("You lose!")
20+
if computer == "scissors":
21+
print("computer: ", computer)
22+
print("player: ", player)
23+
print("You win!")
24+
25+
elif player == "scissors":
26+
if computer == "rock":
27+
print("computer: ", computer)
28+
print("player: ", player)
29+
print("You lose!")
30+
if computer == "paper":
31+
print("computer: ", computer)
32+
print("player: ", player)
33+
print("You won!")
34+
35+
elif player == "paper":
36+
if computer == "scissors":
37+
print("computer: ", computer)
38+
print("player: ", player)
39+
print("You lose!")
40+
if computer == "rock":
41+
print("computer: ", computer)
42+
print("player: ", player)
43+
print("You won!")
44+
45+
play_again = input("Play again? (yes/no): ").lower()
46+
47+
if play_again != "yes":
48+
break
49+
50+
print("Bye!")

0 commit comments

Comments
 (0)