Convert dollar to rupee with real time rate python

Created at 27-Aug-2022 , By samar

Convert dollar to rupee with real time rate python

With this article, we’ll look at some examples of how to address the "Convert dollar to rupee with real time rate python" problem.

There are lots of code snippet available which convert the dollar amount to indian rupee but here I want to convert dollar to rupee with real time rate. To convert dollar to ruppe with real time rate, you have to import `forex_python` library and use it to convet the amount.
  • Covert dollar to rupee with real time rate in python

    Import forex_python library

    pip install forex_python
    

    Code to convert dollar to rupee

    from forex_python.converter import CurrencyRates
    c = CurrencyRates()
    amount = int(input("Enter the amount: "))
    from_currency = input("From Currency: ").upper()
    to_currency = input("To Currency: ").upper()
    print(from_currency, " To ", to_currency, amount)
    result = c.convert(from_currency, to_currency, amount)
    print (result)
    

    Run the python script

Back to code snippet queries related python

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.