我有一個骰子滾輪程序問題(現在的文本,但最終圖形)。它不會在除了我使用的IDE之外的任何工作,Wing IDE 101 4.1。我得到的錯誤閃爍太快,無法閱讀,但我會嘗試截取它。 (如果我得到的截圖,我會編輯這個職位。)爲什麼這個程序不能在shell中工作,但在我的IDE中工作?
下面是程序:
import random
#variables
available_dice = "D20"
main_pgm_start = False
#definitions of functions
def diePick():
print("Pick a die. Your choices are: ", available_dice)
print("")
which_dice = input("")
if which_dice == "D20" or which_dice == "d20":
rollD20()
else:
print("Error: Please try again")
print("")
diePick()
def rollD20():
print("Rolling D20 .... ")
print("")
d20_result = random.randrange(1, 20)
print("You have rolled a ", d20_result)
print("")
print("Would you like to roll again?")
print("")
y = input("")
if y == "y" or y == "Y" or y == "yes" or y == "Yes":
print("")
diePick()
def MainProgram():
print("Benjamin Ward's Random D&D Dice Roller")
print("")
x = input(" Press Enter to Continue")
print("")
diePick()
MainProgram()
你正在使用哪個python版本? – mata
@mata即時通訊使用Python版本3.2,虐待添加到標籤 – Pip
您是否收到任何錯誤消息?你確定從終端開始的python interperter也是python3而不是python2嗎? – mata