-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.py
56 lines (50 loc) · 1.51 KB
/
code.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
import random
while True:
try:
a = int(input("Enter the value of a\n"))
break
except ValueError:
print("sorry wrong input please try again...")
except Exception as error:
print(error)
while True:
try:
b = int(input("Enter the value of b\n"))
break
except ValueError:
print("sorry wrong input please try again...")
except Exception as error:
print(error)
x = random.randint(a, b)
user1_points = 0
while True:
user1_points += 1
player1 = int(input("Enter your number\n"))
if player1 == x:
print("correct")
break
elif player1 > x:
print("oppps you choose greater number plese try again")
elif player1 < x:
print("oppps you choose lesser number plese try again")
import os
os.system("cls")
print("...........................now its second player turn.......................")
user2_points = 0
while True:
user2_points += 1
player1 = int(input("Enter your number\n"))
if player1 == x:
print("correct")
break
elif player1 > x:
print(f"oppps you choose greater number plese try again")
elif player1 < x:
print("oppps you choocse lesser number plese try again")
if user1_points < user2_points:
print("first player won the game")
elif user1_points > user2_points:
print("second player won the game")
else:
print("opps its a tie")
print("Thanks for playing see you soon..................")