Spaces:
Sleeping
Sleeping
File size: 564 Bytes
00192a9 ea8e92e 00192a9 ea8e92e 00192a9 ea8e92e 00192a9 ea8e92e 00192a9 ea8e92e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import streamlit as st
st.title("Simple Arithmetic App")
# Input values
a = st.number_input("Enter first number", value=0.0)
b = st.number_input("Enter second number", value=0.0)
# Operation selection
operation = st.selectbox("Choose an operation", ["Add", "Subtract", "Multiply", "Divide"])
# Result
if operation == "Add":
result = a + b
elif operation == "Subtract":
result = a - b
elif operation == "Multiply":
result = a * b
elif operation == "Divide":
result = "Cannot divide by zero" if b == 0 else a / b
st.write("### Result:", result)
|