can't multiply sequence by non-int of type 'str' Dont understand

前端 未结 2 1809
我在风中等你
我在风中等你 2021-01-28 18:14
yen = 0.0067
bsp = 1.35
usd = 0.65
ero = 0.85

if choice == \"2\":
    Current_Currency = input(\"What currency do you want to exchange: Japenese Yen if so please type y         


        
2条回答
  •  日久生厌
    2021-01-28 19:05

    The line

    Current_Currency = input("What currency do you want to exchange: Japenese Yen if so please type yen // British Sterling Pound please type bsp // US Dollers please Type usd // Euro please type ero.")
    

    will throw an error if an unknown variable is entered, and Current_Currency will be set to the value of the variable name provided by the user, so the line

    if Current_Currency == "yen":
    

    isn't really needed.

    yen = 0.0067
    bsp = 1.35
    usd = 0.65
    ero = 0.85
    
    Current_Currency = input("What currency do you want to exchange: Japenese Yen if so please type yen // British Sterling Pound please type bsp // US Dollers please Type usd // Euro please type ero.")
    amount = input("Type amount you wish to exchange")
    Future_Currency = input("What currency do you want to exchange into: Japenese Yen if so please type yen // British Sterling Pound please type bsp // US Dollers please Type usd // Euro please type ero.")
    New_Amount =  Current_Currency / Future_Currency * amount
    

提交回复
热议问题