import streamlit as st # Dictionary with exchange rates and currency symbols exchange_rates = { "Pakistan (PKR)": (277.50, "₨"), "United States (USD)": (1.00, "$"), "Euro (EUR)": (0.92, "€"), "United Kingdom (GBP)": (0.79, "£"), "India (INR)": (83.00, "₹"), "China (CNY)": (7.20, "¥"), "Japan (JPY)": (150.30, "¥"), "Australia (AUD)": (1.55, "A$"), "Canada (CAD)": (1.35, "C$"), "Switzerland (CHF)": (0.87, "CHF"), "Saudi Arabia (SAR)": (3.75, "﷼"), "UAE (AED)": (3.67, "د.إ"), "Bangladesh (BDT)": (110.00, "৳"), "Russia (RUB)": (92.00, "₽"), "South Africa (ZAR)": (18.50, "R"), "Brazil (BRL)": (5.00, "R$"), "Mexico (MXN)": (17.00, "$"), "Turkey (TRY)": (30.50, "₺"), "Malaysia (MYR)": (4.70, "RM"), "Indonesia (IDR)": (15500.00, "Rp"), "South Korea (KRW)": (1300.00, "₩"), "Singapore (SGD)": (1.35, "S$"), "New Zealand (NZD)": (1.65, "NZ$"), "Vietnam (VND)": (24300.00, "₫"), "Thailand (THB)": (35.50, "฿"), "Egypt (EGP)": (48.00, "E£"), "Philippines (PHP)": (56.00, "₱"), "Argentina (ARS)": (850.00, "$"), "Nigeria (NGN)": (1500.00, "₦"), "Colombia (COP)": (3950.00, "$"), "Chile (CLP)": (920.00, "$"), "Ukraine (UAH)": (38.00, "₴"), "Kazakhstan (KZT)": (470.00, "₸"), "Qatar (QAR)": (3.64, "﷼"), "Kuwait (KWD)": (0.31, "د.ك"), "Bahrain (BHD)": (0.38, "د.ب"), "Oman (OMR)": (0.39, "﷼"), "Sweden (SEK)": (10.50, "kr"), "Norway (NOK)": (10.80, "kr"), "Denmark (DKK)": (6.85, "kr"), "Poland (PLN)": (4.15, "zł"), "Czech Republic (CZK)": (22.00, "Kč"), "Hungary (HUF)": (350.00, "Ft"), "Romania (RON)": (4.60, "lei"), "Serbia (RSD)": (107.00, "дин"), "Israel (ILS)": (3.65, "₪"), "Hong Kong (HKD)": (7.80, "HK$"), "Taiwan (TWD)": (31.50, "NT$") } # Streamlit UI st.title("Currency Converter (50 Currencies) 🌍💰") # Currency selection from_currency = st.selectbox("From Currency:", list(exchange_rates.keys())) to_currency = st.selectbox("To Currency:", list(exchange_rates.keys())) # Amount input amount = st.number_input("Enter Amount:", min_value=0.0, format="%.2f", value=1.0) # Conversion Logic if st.button("Convert"): if from_currency and to_currency: from_rate, from_symbol = exchange_rates[from_currency] to_rate, to_symbol = exchange_rates[to_currency] converted_amount = amount * (to_rate / from_rate) st.success(f"{from_symbol}{amount:,.2f} {from_currency} = {to_symbol}{converted_amount:,.2f} {to_currency}") else: st.warning("Please select both currencies.") # Footer st.markdown("**Note:** Exchange rates are static. Update rates manually as needed.")