-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrockpaperscissor.py
More file actions
30 lines (30 loc) · 830 Bytes
/
rockpaperscissor.py
File metadata and controls
30 lines (30 loc) · 830 Bytes
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
import random
a=True
while a:
choice=input("Enter ur choice :").lower()
choices=["rock",'paper','scissors']
# computer_choice=choices[random.randint(0,len(choices)-1)]
computer_choice=random.choice(choices)
print("computer choice is ",computer_choice)
if choice==computer_choice:
print("it is a tie")
elif choice=='rock':
if computer_choice=='paper':
print('u lose ')
else:
print('u win')
elif choice=='paper':
if computer_choice=='scissors':
print('u lose ')
else:
print('u win')
elif choice=='scissors':
if computer_choice=='rock':
print('u lose ')
else:
print('u win')
elif choice=='exit':
a=False
else:
print('Invalid choice')
print()