Reputation: 1
currencies = {'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 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 = Future_Currency / Current_Currency * amount
honestly this is killing me i just need to get this fixed last hurdle that i cant get over i am a very big novice so please keep the language simple
Upvotes: 0
Views: 103
Reputation: 4733
Both Future_Currency and Current_Currency are strings, as input. It looks like what you want is to use them as keys to your dictionary of rates, as follows:
New_Amount = currencies[Future_Currency] / currencies[Current_Currency] * amount
Or, split up into more lines for readability:
Future_Value = currencies[Future_Currency]
Current_Value = currencies[Current_Currency]
ratio = Future_Value / Current_Value
New_Amount = ratio * amount
Upvotes: 2