2
当我运行程序时IDLE已经打开,它有时需要我按输入才能显示文本。只有当我按下回车键时才会出现Python程序
我该如何让它消失?
代码:
import random
def var():
dice_score = 0
repeat = ""
dicesides = input("Please enter the amount of sides you want the dice to have.\n The amounts you can have are as follows: 4, 6 or 12: ")
script(dice_score, dicesides, repeat)
def script(dicescore, dicesides, repeat):
if dicesides in [4,6,12]:
dice_score = random.randrange(1, dicesides)
print(dicesides, " sided dice, score ", dice_score, "\n")
else:
print("Please Try Again. \n")
var()
repeat = str(input("Repeat? Simply put yes or no: ").lower())
if repeat == "yes":
var()
else:
quit()
var()
感谢。
如果您需要回答或其他问题,请附上相关信息。 – 2013-12-12 10:32:38
没有任何信息,当我运行我的python脚本时,我需要按回车才能显示它。 – user3092741
你正在运行的代码是什么?好像你在等待程序运行时的某种额外输入。 –