Spaces:
No application file
No application file
File size: 901 Bytes
8df584e |
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 |
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) |