Spaces:
Sleeping
Sleeping
File size: 618 Bytes
5339617 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import streamlit as st
from calculator import add, subtract, multiply, divide
st.title("Calculator App")
operation = st.selectbox("Select operation:", ["Add", "Subtract", "Multiply", "Divide"])
x = st.number_input("Enter first number:", value=0)
y = st.number_input("Enter second number:", value=0)
if st.button("Calculate"):
if operation == "Add":
result = add(x, y)
elif operation == "Subtract":
result = subtract(x, y)
elif operation == "Multiply":
result = multiply(x, y)
elif operation == "Divide":
result = divide(x, y)
st.write(f"The result is: {result}")
|