-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day_4_Rock_Paper_Scissors.py
69 lines (54 loc) · 1.42 KB
/
Day_4_Rock_Paper_Scissors.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
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
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
'''
#Write your code below this line 👇
import random
image= [rock, paper, scissors]
names = ["rock", "paper", "scissors"]
while(True):
computer= random.randint(0,2)
user = int(input(f"What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors.\n"))
score= [0,0]
if user >= 3 or user <= 0 :
print("You typed an invalid number, you lose!")
score[0] += 0
score[1] += 1
else:
print(f"You chose {names[user]}")
print(image[user])
print(f"Computer chose {names[computer]}")
print(image[computer])
if int(computer) == int(user) :
print("It's a draw.")
score[0] += 0
score[1] += 0
elif computer == 1 and user == 2 or (computer == 3 and user == 1) or ( computer == 2 and user == 3):
print("You win!")
score[0] += 1
score[1] += 0
elif (computer == 1 and user == 3) or (computer == 3 and user == 2) or (computer == 2 and user == 1):
print("You loose!")
score[0] += 0
score[1] += 1
print(f"You final score\n You- {score[0]} \n Computer - {score[1]}")