In: Computer Science
This needs to be a python3 code
Write a program that prompts the user like this: “Currency to
convert to U.S. dollars: e = Euros, c= Chinese Yuan, r = Indian
Rupees, b = Bitcoin: ”. Then depending on which letter the user
enters, the program displays “Amount of Euros/Yuan/Rupees/Bitcoin
to convert: ”. (Note: the second prompt should only name the one
currency the user asked to convert, not all four currencies.) After
the user enters the amount, the program displays “In U.S. dollars,
that is $N”, (N is the amount converted to U.S. dollars).
Conversion rates (from Google, Aug 25, 2019):
• 1 Euro = 1.11 US dollar • 1 Chinese yuan = 0.14 US dollar • 1
Indian rupee = 0.014 US dollar • 1 Bitcoin = 10283.00 US dollar
while(True):
#reading the conversion type from the user
ch=input("Currency to convert to U.S. dollars: e = Euros, c= Chinese Yuan, r = Indian Rupees, b = Bitcoin: q= Quit\n")
#exit if user selects as q
if ch=="Q" or ch=="q":
break
rate=0
#assigning the rate based on user choice
if(ch=="e" or ch=="E"):
rate=1.11
if(ch=="c" or ch=="C"):
rate=0.14
if(ch=="r" or ch=="R"):
rate=0.014
if(ch=="b" or ch=="B"):
rate=10283.00
#reading the amont to convert
amount=int(input("Enter amount to convert: "))
#printing the USD for given amount
print("$",(rate*amount))
print("Bye..")
Note : If you like my answer please rate and help me it is very Imp for me