calci / app.py
DataWizard9742's picture
Create app.py
c6957fb verified
raw
history blame contribute delete
648 Bytes
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)