這是我重複序列時使用的代碼,但它似乎沒有工作,任何人都可以看到任何問題?代碼是貨幣轉換器。即時通訊使用Python 3.3爲什麼不重複這段代碼? Python 3.3
userDoAgain = input("Would you like to use again? (Yes/No)\n")
if userDoAgain == "Yes":
getChoice()
elif userDoAgain == "No":
print("Thankyou for using this program, Scripted by PixelPuppet")
import time
time.sleep(3)
else:
print("Error: You entered invalid information.")
doagain()
編輯,這是其餘代碼:
if userChoice == "1":
userUSD = float(input("Enter the amount of USD you wish to convert.\n"))
UK = userUSD * 0.62
print("USD", userUSD, "= ", UK, "UK")
elif userChoice == "2":
UK = float(input("Enter the amount of UK Currency you wish to convert.\n"))
userUSD = UK * 1.62
print("UK", UK, "= ", userUSD, "USD")
def doagain():
userDoAgain = raw_input("Would you like to use again? (Yes/No)\n")
if userDoAgain == "Yes":
getChoice()
elif userDoAgain == "No":
print("Thankyou for using this program, Scripted by PixelPuppet")
import time
time.sleep(3)
else:
print("Error: You entered invalid information.")
doagain()
你可以發佈你的代碼的其餘部分?函數'doagain'的'def'語句在哪裏? – Brionius
爲什麼可疑的「輸入時間」,如果你在那個文件中需要它,就在代碼頂部執行它。 – Leonardo
這個縮進是否正確? – tacaswell