-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOddandEvenGame.py
36 lines (31 loc) · 1.03 KB
/
OddandEvenGame.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
import random
d = int(input("best of number of matches (1, 3, 5) only: "))
player = 0
computer = 0
for i in range(1, d + 1):
a = int(input("Enter the number: "))
b = int(input("Enter the number between 0 and {}: ".format(a)))
j = input("Enter the choice(Even, Odd): ").capitalize()
c = random.randint(0, a)
if j == "Odd":
if (c + b) % 2 == 0:
print(c+b)
print("Computer wins, sorry player one")
computer += 1
else:
print(c+b)
print("Computer loses, player wins")
player += 1
if j == "Even":
if (c + b) % 2 == 0:
print(c+b)
print("Computer loses, player one wins")
player += 1
else:
print(c+b)
print("Computer wins, sorry player one")
computer += 1
if computer > player:
print("Computer is the winner, you lose. Game over.")
else:
print("Winner Winner Chicken Dinner")