diff --git a/src/saniya-exp-currency-converter/README.md b/src/saniya-exp-currency-converter/README.md new file mode 100644 index 0000000..be8108d --- /dev/null +++ b/src/saniya-exp-currency-converter/README.md @@ -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 diff --git a/src/saniya-exp-currency-converter/main.py b/src/saniya-exp-currency-converter/main.py new file mode 100644 index 0000000..037d1e5 --- /dev/null +++ b/src/saniya-exp-currency-converter/main.py @@ -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()