2022-08-10 学习Python-Day3
本帖最后由 wyh551202 于 2022-8-11 11:03 编辑改了下小游戏代码,感觉还不错{:10_334:}
####wyh2022.08.10####
import random
couns=0
aa=random.randint(1,10)
for couns in range(3):
couns=couns+1
temp_shuru = input('输入一个猜测的数:')
guess_daan = int(temp_shuru)
if guess_daan == aa:
print(f"答对了!答案是{aa}")
break
else:
print("答错了!!")
if guess_daan < aa:
print("猜小了")
elif guess_daan > aa:
print("猜大了")
print(f"答案是{aa}")
print("end")
页:
[1]