Spaces:
Runtime error
Runtime error
File size: 648 Bytes
c6957fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import streamlit as st
def add(x,y):
return x+y
def sub(x,y):
return x-y
def multiply(x,y):
return x*y
def divide(x,y):
if y==0:
return "Sorry Not possible"
else:
return x/y
st.title("SIMPLE CALCULATOR BY FSA")
num1 = st.number_input("enter first number: ")
num2 = st.number_input("enter second number: ")
choice = st.radio("Select your choice",("ADD","SUBTRACT","MULTIPLY","DIVIDE"))
if choice=="ADD":
result = add(num1,num2)
elif choice=="SUBTRACT":
result = sub(num1,num2)
elif choice=="MULTIPLY":
result = multiply(num1,num2)
elif choice=="DIVIDE":
result = divide(num1,num2)
st.write("Result is: ",result) |