Currency Converter using Python

Search for a command to run...

Many entrepreneurs are trying to find a new way to make money because it can help grow their business. I don't run an Internet business, but I do my best to make money online. Using this resource https://tabtrader.com/articles/what-is-a-trendline , I managed to know more about what is a trendline, so I don't have to be dealing with anyone else. Try to check, Too.
Hey hey... This is so strange I thought I commented here earlier about this article post... well all the same... Nice article and I said I will try it out... in fact, I already did check it out: https://github.com/TijanAyo/PyCurrencyConverter
Do well to drop and star and follow will follow back :) thank you P.s: I added your initials to the code 😊
Which tool you use to take a screenshot of code like you have added in this article?
The series content will mostly cover Technical Python tutorials and my recent learnings and experience in Python.
Hello world! In this Blog article, we will learn how to Automate WhatsApp. We will make use of web.whatsapp.com webpage to automate messages and we will see the implementation in Python. Check out the Repository for Ultimate Resource in python. Drop ...
All you need to know about Hacktoberfest 2021

Hello reader! Well, Hacktoberfest is something, you are gonna hear a lot about in the coming month. You can refer to my YouTube video Tutorial to see a working tutorial for better understanding and a step-by-step guide of the same. https://www.yo...

Hello reader! In this Blog post, I will share some useful code snippets and functions in Python. Give it a read. Let's get started! 1. Memory The method getsizeof can be used to retrieve the size of any object. Here's an example of the same. import...

Hello reader! Whenever a client sends a request to the server, the response always contains a status code. You might not see it always but it's returned at every client-server interaction. Well, even if you are not a programmer, you would still know...

Hello reader! Microsoft subsidiary GitHub launched Copilot to power pair programming with AI. In this blog post, I will share all you need to know about it. You can refer to my YouTube video Tutorial to see a working tutorial for better understandin...

Hello world!
A currency is a system of money in common use, especially for people in a nation, eg, INR, USD and Bitcoin (₿) is a cryptocurrency. In this Blog article, we will learn how to Create Currency Converter. We will see the implementation in Python.
Check out the Repository for Ultimate Resource in python. Drop a star if you find it useful! Got anything to add? Open a PR on the same!
You can refer to my YouTube video Tutorial to see a working tutorial for better Understanding and a step by step Guide of the same.
1. What is BitCoin?
2. What is Currency?
3. Basics of forex-python Module
4. Create Currency Converter using python
Let's get started!
Bitcoin is a cryptocurrency,an innovative payment network, invented in 2008 by an unknown person or group of people using the name Satoshi Nakamoto and started in 2009.
If you wish to know more about it, you can refer to BitCoin Wikipedia Page.
Currency is a medium of exchange for goods and services. In short, it's money, in the form of paper or coins, usually issued by a government and generally accepted at its face value as a method of payment.
If you wish to know more about it, you can refer to Currency Wikipedia Page.
Forex Python is a Free Foreign exchange rates and currency conversion.
List all currency rates.
BitCoin price for all curuncies.
If you wish to know more about it, you can refer to forex-python Module Documentation.
Now that you are familiar with BitCoin and Currency and have acquired basic knowledge of forex-python module, we can move forward to the coding section.
You can find all the code at my GitHub Repository. Drop a star if you find it useful.

In order to access the Python library, you need to install it into your Python environment
pip install forex-python
Now, we need to import the package in our python script. Use the following command to do so.
from forex_python.converter import CurrencyCodes, CurrencyRates
from forex_python.bitcoin import BtcConverter
Let's create an instance of CurrencyCodes. I am naming it as test1.
test1 = CurrencyCodes()
Once done, let's fetch the currency symbol. I am making use of get_symbol method for the same and passing the currency code as a parameter. Let's store it in cur_symbol.
cur_symbol = test1.get_symbol('INR')
Let's fetch the currency name. I am making use of get_currency_name method for the same and passing the currency code as a parameter. Let's store it in cur_name.
cur_name = test1.get_currency_name('INR')
Let's display the output.
print('The currency name is: ' + cur_name)
print('The currency symbol is: ' + cur_symbol)
#let's see for another example
print('\n' + test1.get_symbol('USD'))
print(test1.get_currency_name('USD'))
#OUTPUT:
The currency name is: Indian rupee
The currency symbol is: ₹
US$
United States dollar
Now, let's move forward and create an instance for CurrencyRates.
test2 = CurrencyRates()
Once done, let's fetch the Conversion rate. I will make use of get_rate method for the same. Let's fetch what 1 United States Dollar equals-to in Indian rupee.
rate = test2.get_rate('USD', 'INR')
print(rate)
#OUTPUT:
73.6702434998
Now that we have successfully fetched the conversion rate, let's try converting 10 US$ to Indian rupee. I will make use of convert method for the same.
res = test2.convert('USD', 'INR', 10)
print(res)
#OUTPUT:
736.702434998
I am passing three parameters here,
Let's fetch BITCOIN's latest price details. Let's start by creating an instance of BtcConverter
bitcoin = BtcConverter()
Now, let's fetch the latest price, I will make use of get_latest_price method for the same. Finally, you can printout the result.
price = bitcoin.get_latest_price('INR')
#display the output
print(price)
With these steps, we have successfully Created Currency Converter using python. That's it!
Simple, isn't it? Hope this tutorial has helped. I would strongly recommend you to Check out the YouTube video of the same and don't forget to subscribe my Channel.
You can play around with the forex-python library and even explore more features. You can even make use of Python GUI using Tkinter.
You can find all the code at my GitHub Repository. Drop a star if you find it useful.
Thank you for reading, I would love to connect with you at Twitter | LinkedIn.
Do share your valuable suggestions, I appreciate your honest feedback!
You should definitely check out my other Blogs:
See you in my next Blog article, Take care!!