-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrock_paper_scissors.py
52 lines (40 loc) · 1.03 KB
/
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
import random
# Rock papers and scissors
def game_win(comp, you):
if comp == you:
return None
elif comp == 'r':
if you == 'p':
return True
elif you == 's':
return False
elif comp == 'p':
if you == 's':
return True
elif you == 'r':
return False
elif comp == 's':
if you == 'r':
return True
elif you == 'p':
return False
print("Comp's Turn: Rock(r) Paper(p) or Scissors(s)?")
Comp_Input = random.randint(1, 3)
if Comp_Input == 1:
comp = 'r'
elif Comp_Input == 2:
comp = 'p'
elif Comp_Input == 3:
comp = 's'
name = input("Enter your Name: ")
you = input(f"{name}'s Turn: Rock(r) Paper(p) or Scissors(s)?")
x = game_win(comp, you)
print(f"Computer chose : {comp}")
print(f"{name} chose : {you}")
if x == None:
print("The Game is a Tie!!")
elif x:
print(f"Congratulations!!! {name} Won The Game")
else:
print(f"{name} Lost The Game!!!")
print("Thankyou!!! for playing our game")