calc / app.py
samreen143's picture
Update app.py
fba42fc verified
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 no.:")
num2=st.number_input("enter second no.:")
choice=st.radio("select your choice",("ADD","SUB","MULTIPLY","DIVIDE"))
if choice=="ADD":
result = add(num1,num2)
elif choice=="SUB":
result = sub(num1,num2)
elif choice=="MULTIPLY":
result = multiply(num1,num2)
elif choice=="DIVIDE":
result = divide(num1,num2)
st.write("RESULT IS:",result)