19 lines
384 B
Python
19 lines
384 B
Python
|
import random
|
||
|
num=random.randint(1,100)
|
||
|
count=0
|
||
|
while 1:
|
||
|
input_num=int(input("请输入猜测的数字:"))
|
||
|
if input_num>num:
|
||
|
print("猜大了")
|
||
|
elif input_num<num:
|
||
|
print("猜小了")
|
||
|
else:
|
||
|
print("猜对了")
|
||
|
break
|
||
|
count+=1
|
||
|
|
||
|
if count>5:
|
||
|
print("猜了{}次,菜".format(count))
|
||
|
else:
|
||
|
print("猜了%d次,真厉害"%count)
|