Spaces:
Sleeping
Sleeping
| 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) | |