Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/saniya-exp-currency-converter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Currency Converter

A beginner-friendly Python project to convert any currency to another using user-provided exchange rates.

## 🧩 Features
- Convert any currency to any other currency
- Handles numeric input errors
- Terminal-based interface
- Beginner-friendly and easy to understand

## 🔧 Requirements
- Python 3.x

## 💻 How to Run
```bash
# Open terminal and run:
python main.py

# Example interaction:
# Enter source currency (e.g., USD, INR, EUR): USD
# Enter target currency (e.g., USD, INR, EUR): INR
# Enter amount in USD: 100
# Enter how much 1 USD is worth in INR: 83.5
# Output: 100.00 USD = 8350.00 INR
20 changes: 20 additions & 0 deletions src/saniya-exp-currency-converter/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def currency_converter(amount, rate):
return amount * rate

def main():
print("💰 Welcome to Currency Converter 💰\n")

try:
source_currency = input("Enter source currency (e.g., USD, INR, EUR): ").upper()
target_currency = input("Enter target currency (e.g., USD, INR, EUR): ").upper()
amount = float(input(f"Enter amount in {source_currency}: "))
rate = float(input(f"Enter how much 1 {source_currency} is worth in {target_currency}: "))

converted_amount = currency_converter(amount, rate)
print(f"\n✅ {amount:.2f} {source_currency} = {converted_amount:.2f} {target_currency}")

except ValueError:
print("❌ Invalid input. Please enter numeric values only.")

if __name__ == "__main__":
main()