【发布时间】:2020-05-07 14:41:30
【问题描述】:
我正在尝试制作“猜数字”项目。我做了所有“你需要猜测更高/更低”的事情 但是当我运行代码时,它告诉我猜测更高/更低并完成。它没有给我机会继续或再次猜测 我需要代码才能继续运行 我该怎么做 在此处输入代码 (感谢所有回复和回答的人)
import random
random.randint(0, 100)
random = random.randint(0, 100)
guess = float(input("Guess The Number"))
if guess > random + 50:
print("Too High")
elif guess > random + 25:
print("A little High")
elif guess > random + 10:
print("So Close")
elif guess + 50 < random:
print("Too Low")
elif guess + 25 < random:
print("A little low")
elif guess + 10 < random:
print("So Close")
elif guess == random:
print("Great Job")
else:
print("Guess Again!")
【问题讨论】:
-
提示:查找循环教程。
-
这能回答你的问题吗? How to continuously prompt for user input?
-
while True: # do thing forever
标签: python