Wall06 commited on
Commit
0038d31
·
verified ·
1 Parent(s): 730c8f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py CHANGED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ st.set_page_config(page_title="Simple Calculator", page_icon="🧮")
4
+
5
+ st.title("🧮 Simple Calculator")
6
+
7
+ # Input numbers
8
+ num1 = st.number_input("Enter first number:", value=0.0, step=1.0)
9
+ num2 = st.number_input("Enter second number:", value=0.0, step=1.0)
10
+
11
+ # Select operation
12
+ operation = st.selectbox("Choose operation:", ["Addition", "Subtraction", "Multiplication", "Division"])
13
+
14
+ # Perform calculation
15
+ if st.button("Calculate"):
16
+ if operation == "Addition":
17
+ result = num1 + num2
18
+ elif operation == "Subtraction":
19
+ result = num1 - num2
20
+ elif operation == "Multiplication":
21
+ result = num1 * num2
22
+ elif operation == "Division":
23
+ if num2 != 0:
24
+ result = num1 / num2
25
+ else:
26
+ result = "Error! Division by zero."
27
+
28
+ st.success(f"Result: {result}")