Auto commit

上级 becd727a
print('欢迎来到 InsCode')
\ No newline at end of file
import random
# 生成一个随机数
number = random.randint(1, 100)
# 记录猜的次数
count = 0
# 循环猜数字
while True:
guess = int(input("请猜一个1到100之间的数字:"))
count += 1
if guess == number:
print("恭喜你猜对了!你一共猜了%d次。" % count)
break
elif guess < number:
print("猜的数字太小了,请再猜一次。")
else:
print("猜的数字太大了,请再猜一次。")
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册