Master Python with 70+ Hands-on Projects and Get Job-ready - Learn Python
Program 1
# Currency Covert Project
from forex_python.converter import CurrencyRates
def currency_covert():
c=CurrencyRates()
try:
print("------------Currency Covertor-------------------")
from_currency=input("Enter base currency(i.e USD INR EUR)")
target_currency=input("Enter target currency(i.e USD INR EUR)")
str="Enter an amount in {} currency for convert"
str=str.format(from_currency)
amount=float(input(str))
converted_amount=c.convert(from_currency,target_currency,amount)
str="Your{} Amount from {} currency to {} is {}"
str=str.format(amount,from_currency,target_currency,converted_amount)
print(str)
except:
print("Invlid currency code. conversion is fail pls try again ")
# Main Calling
currency_covert()