-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrockPaperScissors.py
74 lines (69 loc) · 1.63 KB
/
rockPaperScissors.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
import random
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
'''
choices = [rock, paper, scissors]
print("\t\t\tRock, Paper and Scissors *HARDEST*")
while True:
print("What do you choose?")
num = int(input("0 for rock, 1 for paper and 2 for scissors: "))
if num > 2 or num < 0:
print("Inavlid choice.\nYou lost")
break
user_choice = choices[num]
print(user_choice)
print("Computer chose:")
if user_choice == rock:
comp_choice = random.choice(choices)
print(comp_choice)
if comp_choice == rock:
print("Its a draw")
elif comp_choice == paper:
print("You lost")
else:
print("You won!!")
elif user_choice == paper:
comp_choice = random.choice(choices)
print(comp_choice)
if comp_choice == rock:
print("You won!!")
elif comp_choice == paper:
print("Its a draw")
else:
print("You lost")
else:
comp_choice = random.choice(choices)
print(comp_choice)
if comp_choice == rock:
print("You lost")
elif comp_choice == paper:
print("You Won!!")
else:
print("Its a draw")
cont = input("Do you want to continue playing (Y/N)").lower()
if cont == "n":
print("Okay Goodbye!!")
break
else:
continue