geo-metriccalci / app.py2
Mohsinkhan77's picture
Create app.py2
c875697 verified
import streamlit as st
def area_of_square(s):
return(s*s)
def area_of_circle(r):
return((24/7)*r*r)
def area_of_rectangle(l,b):
return(l*b)
def area_of_triangle(x,y):
return((1/2)*b*h)
st.title ("geometric calculator")
choice = st.radio("select your choice",("square","circle", "rectangle", "triangle"))
if choice == "square":
s = st.number_input("enter the length of side square")
if st.button ("calculate"):
result = area_of_square(s)
st.write("area", result)
elif choice =="circle":
r = st.number_input("enter the radius of circle")
if st.button ("calculate"):
result = area_of_circle(r)
st.write ("area", result)
elif choice == "rectangle":
l = st.number_input ("enter the length of rectangle")
b = st.number_input ("enter the breathe of rectangle")
if st.button("calculate"):
result = area_of_rectangle(l,b)
st.write ("area", result)
elif choice == "triangle":
x = st.number_input ("enter the base of triangle")
y = st.number_input ("enter the height of triangle")
if st.button ("calculate"):
result = area_of_triangle(x,y)
st.write ("area", result)
st.write ("result is",result)