Write a program that prompts the user to enter the currency exchange between US dollars and the Chinese renminbi. prompt the user to enter 0 to convert from us dollars to Chinese RMB and 1 for vice versa. Prompt the user to enter the amount in US dollars or Chinese RMB to convert it to Chinese RMB or US dollars, respectively,
Sample Run:
Enter the exchange rate from dollars to RMB: 6.58
Enter 0 to convert dollars to RMB and 1 vice versa: 0
Enter the dollar amount: 100
100.00 dollars is 658.00 Yuan
please answer in Python. Thanks :)
print("Enter the exchange rate from dollars to RMB: ")
exchange_rate = input()
print("Enter 0 to convert dollars to RMB and 1 vice versa:")
choice = input()
if choice == 0:
print("Enter the dollar amount: ")
dollar = input()
result1 = (dollar * exchange_rate * 100) / 100.0;
print(dollar,"dollar is",result1,"yuan")
elif choice == 1:
print("Enter the RMB amount: ")
RMB = input()
result2= (rmb / exchange_rate* 100) / 100.0;
print(RMB,"yuan is",result2,"dollars")
Get Answers For Free
Most questions answered within 1 hours.