Программа не выполняет 4-й пункт моего меню, который является валютным переводчиком
def addition(): #Addition a1 = int(input("Enter your first number: ")) b1 = int(input("Enter secondary number: ")) c1 = a1 + b1 print("-------------------------------") print(a1," + ",b1," = ",c1," . ") print("-------------------------------") def subtraction(): #Subtraction a2 = int(input("Enter your first number: ")) b2 = int(input("Enter your first number: ")) c2 = a2-b2 print("-------------------------------") print(a2," - ",b2," = ",c2," . ") print("-------------------------------") def multiplication(): #Multiplication a3 = int(input("Enter your first number: ")) b3 = int(input("Enter your first number: ")) c3 = a3*b3 print(a3," * ",b3," = ",c3," . ") def division(): #Division a4 = int(input("Enter your first number: ")) b4 = int(input("Enter your first number: ")) c4 = a4/b4 print(a4," / ",b4," = ",c4," . ") def mathmenu(): print("1. Addition") print("2. Subtraction") print("3. Multiplication") print("4. Division") def menu(): print("") print("||||| 1. Math Operations |||||") print("||||| 2. Personal Database |||||") print("||||| 3. Message Encrypter/Decrypter |||||") print("||||| 4. Currency Translator |||||") print("||||| 5. Open File |||||") print("||||| 6. Dictionary |||||") print("||||| ") print (" Welcome to Gage's Vault") loop = True while loop: menu() choice = int(input("What would you like to do today?: ")) print("") print("") print("") if choice==1: print("Math Operations") mathmenu() choice1 = int(input("Choose Math Operation: ")) if choice1==1: addition() elif choice1==2: subtraction() elif choice1==3: multiplication() elif choice1==4: division() elif choice==2: print("Personal Database") elif choice==3: print("Message Encrypter/Decrypter") elif choice==4: # All currency base integers are equilvalent to USD .01 penny # Resource = http://www.xe.com/currencyconverter/convert/?Amount=.01&From=USD&To=INR # Updated as of 28FEB18 print("Currency Translator") print("-----------------------------------------") print("1. USD") #.01 /United States Currency print("2. Euro")#.00818015 /European Currency print("3. GPD") #.00719363 /British Pound print("4. INR") #.651016 /Indian Rupee elif choice==5: print("Open file") elif choice ==6: print("Dictionary") else: raw_input("Incorrect Calculation. Enter any key to continue......")
Что я уже пробовал:
Я пытался в течение 3 часов, но ничего не добился с этой проблемой.
Richard MacCutchan
Не используйте везде один и тот же код. Сначала получите два числа, а затем выберите операцию для выполнения.