In this tutorial, we will learn how to use a Real-time Currency Converter in python using forex converter Library.
A real-time currency converter is a python library that allows you to convert currencies in real-time. It supports multiple currencies and has a very easy-to-use API.
To use the Library, you first need to install it. You can install it using the following command.
pip install forex-python
Features of Forex converter
- All exchange rates are available
- Bitcoin Price for all currencies
How to Use Real-time currency Converter Python Script?
# Import the forex python library from forex_python.converter import CurrencyRates c = CurrencyRates() # User inputs for currency converter user_amount = int(input("Enter the amount you want to convert: ")) from_currency = input("Enter the currency code that has to be converted: ").upper() #USD,INR,GBP to_currency = input("Enter the currency code to convert: ").upper() #USD,INR,GBP #Printing the O/P output = c.convert(from_currency, to_currency, user_amount) print("The converted rate is:", output)
Output of Real-time Currency Converter
Enter the amount you want to convert: 100 Enter the currency code that has to be converted: USD Enter the currency code to convert: INR The converted rate is: 7980
From this tutorial, you have learned how to use a Real-time Currency Converter in python.
Do let us know your comments and feedback in the comments section below.
If my articles on TipsonUNIX have helped you, kindly consider buying me a coffee as a token of appreciation.
Thank You for your support!!