eyeman00 commited on
Commit
bba164e
·
verified ·
1 Parent(s): e29c745

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +28 -0
  2. requirement.txt +1 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ st.title("Simple Calculator")
4
+
5
+ # Input fields
6
+ num1 = st.number_input("Enter first number", format="%.2f")
7
+ num2 = st.number_input("Enter second number", format="%.2f")
8
+
9
+ # Operation selection
10
+ operation = st.selectbox("Select operation", ["+", "-", "*", "/"])
11
+
12
+ # Perform calculation
13
+ if st.button("Calculate"):
14
+ if operation == "+":
15
+ result = num1 + num2
16
+ st.success(f"The result is: {result}")
17
+ elif operation == "-":
18
+ result = num1 - num2
19
+ st.success(f"The result is: {result}")
20
+ elif operation == "*":
21
+ result = num1 * num2
22
+ st.success(f"The result is: {result}")
23
+ elif operation == "/":
24
+ if num2 != 0:
25
+ result = num1 / num2
26
+ st.success(f"The result is: {result}")
27
+ else:
28
+ st.error("Cannot divide by zero!")
requirement.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ streamlit