Skip to content

Commit a590eed

Browse files
committed
1.新增猜数字游戏
1 parent 1d6e337 commit a590eed

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

com/lxl/base/Guess_game.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from random import randint
2+
3+
4+
def play():
5+
random_int=randint(1,100)
6+
7+
while True:
8+
user_guess=int(input("please input one number between 1 to 100:"))
9+
10+
if user_guess==random_int:
11+
print("you win")
12+
break
13+
if user_guess<random_int:
14+
print("less")
15+
continue
16+
if user_guess>random_int:
17+
print("more")
18+
continue
19+
20+
21+
if __name__=='__main__':
22+
play()

0 commit comments

Comments
 (0)