-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRock paper scissors with python.py
More file actions
40 lines (38 loc) · 1.27 KB
/
Copy pathRock paper scissors with python.py
File metadata and controls
40 lines (38 loc) · 1.27 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
#To create a rock,paper and scissor game we need to first take the input from the user and compare it with the computer choice which is taken using the random module in the python from a list of choices
import random
choices=['Rock','Paper','Scissors']
AI=random.choice(choices)
player=False
AI_Score=0
Player_score=0
while True:
player=input("Rock,Paper or Scissor??").capitalize()
#Conditions
if player == AI:
print('Tie..!')
elif player == "Rock":
if AI == "Paper":
print("You lose!", AI,'cover',player)
AI_Score+=1
else:
print('You win..!',player,'Smashes',AI)
Player_score+=1
elif player == "Scissors":
if AI == "Rock":
print("You lose.!",AI,'smashes the',player)
AI_Score+=1
else:
print('You win',player,'cuts',AI)
Player_score+=1
elif player == "Paper":
if AI == "Scissors":
print('You lose..!',AI,'Cuts',player)
AI_Score+=1
else:
print('You win',player,'Covers',AI)
Player_score+=1
elif player=='End':
print('Final scores: ')
print(f"AI:{AI_Score}")
print(f"Player:{Player_score}")
break