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
你正在運行的代碼是什麼?好像你在等待程序運行時的某種額外輸入。 –