forked from Teingi/python-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguess_num.py
45 lines (39 loc) · 1.11 KB
/
guess_num.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
#!--codding-utf-8
import random
def game(secret):
guess = 0
print('---------猜数字游戏!---------')
secret = random.randint(1,100)
while guess !=secret:
# print('---------猜数字游戏!---------')
tem = input("I'm thinking of a number! Try to guess the number I'm thinking of:")
guess = int(tem)
if guess > secret:
print('Too hign! Guess again:')
else:
print('Too low! Guess again:')
if guess == secret:
str = input("That's it! Would you like to play again?(yes/no)")
while str == 'yes':
game(-1)
return 0
# guess == 0
game(-1)
#game(secret_init)
# else:
# return 0
'''
import random
print('---------猜数字游戏!---------')
secret = random.randint(1,100)
guess = 0
while guess !=secret:
tem = input("I'm thinking of a number! Try to guess the number I'm thinking of:")
guess = int(tem)
if guess > secret:
print('Too hign! Guess again:')
else:
print('Too low! Guess again:')
if guess == secret:
print("That's it! Would you like to play again?(yes/no)")
'''