g-eometric / app.py
Mohsinkhan77's picture
Create app.py
661a8fa 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 side of square")
result = area_of_square(s)
elif choice =="circle":
r = st.number_input("enter the radius of circle")
result = area_of_circle(r)
elif choice == "rectangle":
l = st.number_input ("enter the length of rectangle")
b = st.number_input ("enter the breathe of rectangle")
result = area_of_rectangle(l,b)
elif choice == "triangle":
x = st.number_input ("enter the base of triangle")
y = st.number_input ("enter the height of triangle")
result = area_of_triangle(x,y)
st.write ("result is",result)