✅ Python Project Real-Time Currency Converter using API 💱🌐

 

✅ Python Project : Real-Time Currency Converter using API 💱🌐

📌 Task:
Make a Python program that converts money from one currency to another using live exchange rates from an API (like exchangerate.host).

🧠 What You’ll Learn:

  • Calling REST APIs with requests

  • Using query parameters in API calls

  • Reading and parsing JSON responses

  • Performing real-time currency conversion

📌 Task:
Make a Python program that converts money from one currency to another using live exchange rates from an API (like exchangerate.host).

🧠 What You’ll Learn:

  • Calling REST APIs with requests

  • Using query parameters in API calls

  • Reading and parsing JSON responses

  • Performing real-time currency conversion


✅ Python Code Example

import requests def currency_exchange(base, target, value): api_url = "https://api.exchangerate.host/convert" options = { "from": base, "to": target, "amount": value } response = requests.get(api_url, params=options) if response.status_code == 200: result = response.json() converted_value = result["result"] print(f"💱 {value} {base.upper()} = {converted_value:.2f} {target.upper()}") else: print("⚠️ Unable to fetch exchange rates at the moment.") # Example Run currency_exchange("eur", "usd", 50)


📤 Sample Output:

💱 50 EUR = 53.27 USD

📥 How It Works:

  1. Sends request with base currency, target currency & amount

  2. API responds with live conversion rates

  3. Displays result in a clear format


🔧 Try Yourself:

  • Use input() to allow user entry for amount & currency codes

  • Handle multiple conversions in one run

  • Create a simple Tkinter or PyQt GUI


💡 Where You Can Use It:
✅ Personal currency tracker
✅ Travel & expense planning
✅ Finance or stock market apps

Comments

Popular posts from this blog

🔁 Top 30 Python List Methods You Should Know

Python Project 7: Read & Write JSON Files

✅ Python – Quick Start Guide for Beginners