forked from fenyx-it-academy/Class6-Python-Module-Week1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRockScissorsPaperGame.py
More file actions
60 lines (57 loc) · 2.48 KB
/
Copy pathRockScissorsPaperGame.py
File metadata and controls
60 lines (57 loc) · 2.48 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
user_choice = {}
user1 = input("Enter User Name 1 : ")
user2 = input("Enter User Name 2 : ")
score_user1 = 0
score_user2 = 0
while True:
i = 0
while i <= 10:
user1_choice = input("Enter a choice (rock, paper, scissors): ")
user2_choice = input("Enter a choice (rock, paper, scissors): ")
user_choice[user1] = user1_choice
user_choice[user2] = user2_choice
print(user_choice)
if user1_choice == user2_choice:
print("Both players selected" ,user1_choice, " it a tie!")
print(user1,'has',score_user1,'points and',user2,'has',score_user2,'points')
elif user1_choice == "rock":
if user2_choice == "scissors":
print("Rock smashes scissors!", user1, "Gets 1 Point!")
score_user1 = score_user1+1
print(user1,'has',score_user1,'points and',user2,'has',score_user2,'points')
else:
print("Paper covers rock!", {user2}, "Gets 1 Point!")
score_user2 = score_user2+1
print(user1,'has',score_user1,'points and',user2,'has',score_user2,'points')
elif user1_choice == "paper":
if user2_choice == "rock":
print("Paper covers rock!" , user1, "Gets 1 Point!")
score_user1 = score_user1+1
print(user1,'has',score_user1,'points and',user2,'has',score_user2,'points')
else:
print("Scissors cuts paper!" , user2, "Gets 1 Point!")
score_user2 = score_user2+1
print(user1,'has',score_user1,'points and',user2,'has',score_user2,'points')
elif user1_choice == "scissors":
if user2_choice == "paper":
print("Scissors cuts paper!", user1, "Gets 1 Point!")
score_user1 = score_user1+1
print(user1,'has',score_user1,'points and',user2,'has',score_user2,'points')
else:
print("Rock smashes scissors!" , user2, "Gets 1 Point")
score_user2 = score_user2+1
print(user1,'has',score_user1,'points and',user2,'has',score_user2,'points')
i+=1
if score_user1 > score_user2:
print(user1,"WINS!")
elif score_user2 > score_user1:
print(user2,"WINS THE GAME!")
else:
print("It's a tie!")
play = input("Do you want to play again? Press Y for Yes, N for N0 --->")
if play.upper() == "Y":
i=0
continue
else:
print("BYE")
break