EngrKashifKhan commited on
Commit
299a8a1
·
verified ·
1 Parent(s): 4735d36

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ # App title
4
+ st.title("Simple Calculator (+, -)")
5
+
6
+ # Input numbers
7
+ num1 = st.number_input("Enter first number:", format="%.2f")
8
+ num2 = st.number_input("Enter second number:", format="%.2f")
9
+
10
+ # Operation selection
11
+ operation = st.radio("Choose operation:", ("Addition (+)", "Subtraction (-)"))
12
+
13
+ # Perform calculation
14
+ if st.button("Calculate"):
15
+ if operation == "Addition (+)":
16
+ result = num1 + num2
17
+ st.success(f"Result: {num1} + {num2} = {result}")
18
+ elif operation == "Subtraction (-)":
19
+ result = num1 - num2
20
+ st.success(f"Result: {num1} - {num2} = {result}")