-
Notifications
You must be signed in to change notification settings - Fork 0
/
tt.py
67 lines (58 loc) · 1.38 KB
/
tt.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
# name = prabhjot singh
print("=>In this game computer will chosse who play first")
def chose():
import random
global players
players= random.randint(1,2)
return players
def play1():
import random
print(" now player first turn\n")
n= random.randint(1,100)
m = int(input("enter a number between 1 to 100\n"))
counter=1
while m!=n:
if m>n:
print("imagine small number\n ")
else:
print("imagine bigger number\n")
m= int(input("enter nimber 1 to 100\n"))
counter+=1
global d
d= counter
else:
print(f"first player takes {counter} steps\n")
def play2():
import random
print(" now secend player turn")
n= random.randint(1,100)
m = int(input("enter a number 1 to100\n"))
counter=1
while m!=n:
if m>n:
print("think small number\n")
else:
print(" think bigger number\n")
m = int(input("enter 1 to 100\n"))
counter+=1
global g
g= counter
else:
print(f"secend player takes total {counter} steps")
def com():
if g>d:
print(f"player first win the gmae with total {d} steps")
else:
print(f"player secend win the game wth total {g} steps")
def main():
r=chose()
print(r)
if r==1:
play1()
play2()
if r==2:
play2()
play1()
break
com()
main()