-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path35. Project 01-Rock-Paper-Scissors.py
More file actions
69 lines (57 loc) · 1.43 KB
/
Copy path35. Project 01-Rock-Paper-Scissors.py
File metadata and controls
69 lines (57 loc) · 1.43 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
"""
Project: Rock, Paper, Scissors Game
Write a Python program where:
The user chooses Rock (0), Paper (1), or Scissors (2).
The computer randomly selects one of the three options.
Display both the user and computer choices using ASCII art.
Determine the winner:
1. Rock beats Scissors
2. Scissors beats Paper
3. Paper beats Rock
Display the result: You win!, Computer wins!, or It's a tie!
"""
Rock = '''
_______
---' ____)____
(_____)
(_____)
(____)
---.__(___)
ROCK
''' # Representing a clenched fist
Paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
| |
| PAPER |
|_______|
''' # Representing an open hand
Scissors = '''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
SCISSORS
''' # Two fingers extended
rps = int(input("Select Rock(0), Paper(1) or Scissors(2) : "))
rps_list = [Rock, Paper, Scissors]
if rps>= 3 or rps<0:
print("Invalid input")
else:
print(f"you selected : {rps_list[rps]}")
import random
comp_rps = random.randint(0, 2)
#print(comp_rps)
print(f"comp selected : {rps_list[comp_rps]}")
if rps == comp_rps:
print("It's a tie!")
elif (rps==0 and comp_rps==2) or (rps==1 and comp_rps==0) or (rps==2 and comp_rps==1):
print('You won!')
else:
print("Computer wins!")