Spaces:
Sleeping
Sleeping
File size: 616 Bytes
299a8a1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import streamlit as st
# App title
st.title("Simple Calculator (+, -)")
# Input numbers
num1 = st.number_input("Enter first number:", format="%.2f")
num2 = st.number_input("Enter second number:", format="%.2f")
# Operation selection
operation = st.radio("Choose operation:", ("Addition (+)", "Subtraction (-)"))
# Perform calculation
if st.button("Calculate"):
if operation == "Addition (+)":
result = num1 + num2
st.success(f"Result: {num1} + {num2} = {result}")
elif operation == "Subtraction (-)":
result = num1 - num2
st.success(f"Result: {num1} - {num2} = {result}")
|