-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnumberwar.py
More file actions
47 lines (35 loc) · 898 Bytes
/
numberwar.py
File metadata and controls
47 lines (35 loc) · 898 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import sys
import time
import random
#variables
score = 0
score1 = 0
target = 2
while 1:
number = random.randint(1,5)
guess = int(input("Player one : "))
guess1 = int(input("Player two : "))
print("")
print("The number was ", number)
print("")
if guess == number:
score = score + 1
print("Player one score : ", score)
print("Player two score : ", score1)
elif guess1 == number:
score1 = score1 + 1
print("Player one score : ", score1)
print("Player one score : ", score)
else:
print("")
print("none of the guess were correct!")
if score == target:
print("")
print("Player one has won the game")
print("")
sys.exit()
elif score1 == target:
print("")
print("Player two has won the game")
print("")
sys.exit()