In: Computer Science
You are back from world tour visiting many countries. You have money in various currencies. Write a program to come up with how much money it will all amount to in USD. So if user entered they have 10 as the value of Euros they have, then the equivalent $ value would be 10 EUR = 11.0501 USD if it is 09/09/2019 conversion rate of 1 USD = 0.904968 EUR Use the conversion rates given below in the list - do not change it to today's values conversionRate = [ [“EUR”, 0.85, "Euro"], [“GBP”, 0.76, "British pounds"], [“INR”, 71.96, "Indian Rupees"], [“AUD”, 1.39, "Australian Dollars"], [“JPY”, 111.35, "Japanese Yen" ], [“CNY”, 6.84, "Chinese Yuan"] ] Prompt the user to enter how much do they have of each currency given in the list conversionRate. (If user doesn’t have a specific currency, advise the user to enter 0).
After getting entries for all currency types in the list, convert each of those into USD and print the total value in USD.
Please enter 0 if you do not possess a particular currency
How much do you have in EURO ? 10
How much do you have in British pounds ? 10
How much do you have in Indian Rupees ? 2000
How much do you have in Australian Dollars ? 20
How much do you have in Japanese Yen ? 10
How much do you have in Chinese Yuan ? 10
Total amount after conversion is 68.65 USD
Please enter 0 if you do not possess a particular currency
How much do you have in EURO ? 10
How much do you have in British pounds ? 10
How much do you have in Indian Rupees ? 0
How much do you have in Australian Dollars ? 0
How much do you have in Japanese Yen ? 10
How much do you have in Chinese Yuan ? 10
***PYTHON*** PLEASE
Complete Code:
Sample Output:
CODE TO COPY:
#list of conversion rates
conversionRate = [ ["EUR", 0.85, "Euro"], ["GBP", 0.76, "British
pounds"],
["INR", 71.96, "Indian Rupees"], ["AUD", 1.39, "Australian
Dollars"],
["JPY", 111.35, "Japanese Yen" ], ["CNY", 6.84, "Chinese Yuan"]
]
#prompt the user to enter how much do they have of each
currency
print("Please enter 0 if you do not possess a particular
currency")
eur = float(input("How much do you have in EURO ? "))
gbp = float(input("How much do you have in British pounds ?
"))
inr = float(input("How much do you have in Indian Rupees ?
"))
aud = float(input("How much do you have in Australian Dollars ?
"))
jpy = float(input("How much do you have in Japanese Yen ? "))
cny = float(input("How much do you have in Chinese Yuan ? "))
#convert each currency into USD using the entries for currency
types in the list
eurUSD = eur/conversionRate[0][1]
gbpUSD = gbp/conversionRate[1][1]
inrUSD = inr/conversionRate[2][1]
audUSD = aud/conversionRate[3][1]
jpyUSD = jpy/conversionRate[4][1]
cnyUSD = cny/conversionRate[5][1]
#compute the total value in USD
totalUSD = eurUSD + gbpUSD + inrUSD + audUSD + jpyUSD + cnyUSD
#print the total value in USD
print("\nTotal amount after conversion is %.2f USD" % (int(totalUSD
* 100)/100))