Convert dollar to rupee with real time rate python

Updated at 26-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