import random
import os
a= random.randint(0,101)
from time import sleep
def printer(text,delay=0.2):
for ch in (text):
print(ch,end='',flush=True)
sleep(delay)
def cls():
os.system("cls")
cls()
while True:
b=int(input('猜猜数字是几'))
print(b)
if a>b:
print("\n"*1)
printer('小了')
sleep(0.11112)
cls()
continue
elif a<b :
("\n"*1)
printer('大了')
sleep(0.11112)
cls()
continue
elif a==b:
("\n"*1)
printer('正确')
sleep(0.11112)
break
Python--猜数字,代码参考
于 2023-09-03 09:28:28 首次发布