-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrockPaperScissorGame.py
86 lines (82 loc) · 2.22 KB
/
rockPaperScissorGame.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import random
welcome = '''
__ __ _
\ \ / / | |
\ \ /\ / /__| | ___ ___ _ __ ___ ___
\ \/ \/ / _ \ |/ __/ _ \| '_ ` _ \ / _ \
\ /\ / __/ | (_| (_) | | | | | | __/
\/ \/ \___|_|\___\___/|_| |_| |_|\___|
'''
print(welcome)
user_score = 0
comp_score = 0
while True:
user_choice = input("Enter Rock(R), Paper(P), Scissors(S) \nEnter 'E' to exit\n -->: ")
if user_choice == 'E':
break
rock = '''
______
---' ____)
(_____)
(_____)
(_____)
---.__(___)
'''
paper = '''
_______
---' ______)____
________)
________)
________)
---.____________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
'''
print("You choose")
if user_choice == 'R':
print("Rock")
print(rock)
elif user_choice == 'P':
print("Paper")
print(paper)
elif user_choice == 'S':
print("Scissors")
print(scissors)
else:
print("--------> Wrong input <---------\n")
continue
random_choice = random.randint(1, 3)
print("Computer choose")
if random_choice == 1:
computer_choice = 'R'
print("Rock")
print(rock)
elif random_choice == 2:
computer_choice = 'P'
print("Paper")
print(paper)
else:
computer_choice = 'S'
print("Scissors")
print(scissors)
if(user_choice == computer_choice):
print("Draw")
elif((user_choice == 'R' and computer_choice == 'S') or (user_choice == 'S' and computer_choice == 'P') or (user_choice == 'P' and computer_choice == 'R')):
print("You won!")
user_score += 1
else:
print("Computer won!")
comp_score +=1
print(f"Your Score: {user_score}, computer Score: {comp_score}\n****************************************************************\n")
if(user_score>comp_score):
print("You have won")
elif(user_score<comp_score):
print("You have lost")
else:
print("Its a draw!")