Python Project – Currency Converter

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()

 

We work very hard to provide you quality material
Could you take 15 seconds and share your happy experience on Google

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *