Are you looking to build a solid career in Python? If Yes, you have to work on projects. DataFlair is devoted to make you a successful Python Developer. After tons of tutorials, practicals, interview questions, we are coming with a series of projects from beginner to advanced level.

In this tutorial, we are going to build an exciting python project through which you can convert currencies. For a user interface, we are going to use the tkinter library

Currency Converter in Python

Prerequisites

The currency converter project in python requires you to have basic knowledge of python programming and the pygame library.

  • tkinter – For User Interface (UI)
  • requests – to get url

To install the tkinter and requests library, type the following code in your terminal:

pip install tkinter
pip install requests

Steps to Build the Python Project on Currency Converter

  1. Real-time Exchange rates
  2. Import required Libraries
  3. CurrencyConverter Class
  4. UI for CurrencyConverter
  5. Main Function

1. Real-time Exchange rates

To get real-time exchange rates, we will use: https://api.exchangerate-api.com/v4/latest/USD

Here, we can see the data in JSON format, with the following details:

Base – USD: It means we have our base currency USD. which means to convert any currency we have to first convert it to USD then from USD, we will convert it in whichever currency we want.

Date and time: It shows the last updated date and time.

Rates: It is the exchange rate of currencies with base currency USD.

2. Import the libraries:

For this project based on Python, we are using the tkinter and requests library. So we need to import the library.

import requests
from tkinter import *
import tkinter as tk
from tkinter import ttk

#python tutorials #python #programming

Currency Converter - Python Project with Source Code
146.95 GEEK