这是我在重复我使用过的序列时使用的代码,但它似乎没有工作任何人都可以看到任何问题吗?该代码用于货币转换器。我使用 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()