File size: 1,841 Bytes
7031c82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a69039e
7031c82
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# calculator_app.py

import streamlit as st

st.set_page_config(page_title="Interactive Calculator", page_icon="🧮", layout="centered")

st.markdown("<h1 style='text-align: center;'>🧮 Simple Calculator App</h1>", unsafe_allow_html=True)
st.markdown("<p style='text-align: center; color: gray;'>Perform basic math operations easily and quickly😉!</p>", unsafe_allow_html=True)

# --- Layout with columns and containers ---
with st.container():
    col1, col2 = st.columns(2)
    
    with col1:
        num1 = st.number_input("🔢 Enter First Number", value=0.0, step=1.0)
    with col2:
        num2 = st.number_input("🔢 Enter Second Number", value=0.0, step=1.0)

with st.container():
    operation = st.radio(
        "🧩 Choose Operation",
        options=["➕ Addition", "➖ Subtraction", "✖️ Multiplication", "➗ Division"],
        horizontal=True
    )

# --- Perform calculation ---
st.markdown("---")
if st.button("🎯 Calculate"):
    st.subheader("📄 Result Details:")
    if operation == "➕ Addition":
        result = num1 + num2
        st.success(f"✅ {num1} + {num2} = {result}")
    elif operation == "➖ Subtraction":
        result = num1 - num2
        st.success(f"✅ {num1} - {num2} = {result}")
    elif operation == "✖️ Multiplication":
        result = num1 * num2
        st.success(f"✅ {num1} × {num2} = {result}")
    elif operation == "➗ Division":
        if num2 == 0:
            st.error("❌ Cannot divide by zero!")
        else:
            result = num1 / num2
            st.success(f"✅ {num1} ÷ {num2} = {result}")
else:
    st.info("Please enter values and select an operation, then press 'Calculate'.🤗")

# Footer
st.markdown("---")
st.markdown("<p style='text-align: center; font-size: 12px; color: gray;'>Build by ALISHBA😏</p>", unsafe_allow_html=True)