Spaces:
No application file
No application file
Mohsinkhan77
commited on
Commit
•
8df584e
1
Parent(s):
0bbb3ba
Create app.py GC
Browse files
app.py GC
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
def area_of_square(s):
|
4 |
+
return(s*s)
|
5 |
+
def area_of_circle(r):
|
6 |
+
return((24/7)*r*r)
|
7 |
+
def area_of_rectangle(l,b):
|
8 |
+
return(l*b)
|
9 |
+
def area_of_triangle(x,y):
|
10 |
+
return((1/2)*b*h)
|
11 |
+
|
12 |
+
st.title ("geometric calculator")
|
13 |
+
|
14 |
+
choice = st.radio("select your choice",("square","circle", "rectangle", "triangle"))
|
15 |
+
|
16 |
+
if choice == "square":
|
17 |
+
s = st.number_input("enter the side of square")
|
18 |
+
result = area_of_square(s)
|
19 |
+
elif choice =="circle":
|
20 |
+
r = st.number_input("enter the radius of circle")
|
21 |
+
result = area_of_circle(r)
|
22 |
+
elif choice == "rectangle":
|
23 |
+
l = st.number_input ("enter the length of rectangle")
|
24 |
+
b = st.number_input ("enter the breathe of rectangle")
|
25 |
+
result = area_of_rectangle(l,b)
|
26 |
+
elif choice == "triangle":
|
27 |
+
x = st.number_input ("enter the base of triangle")
|
28 |
+
y = st.number_input ("enter the height of triangle")
|
29 |
+
result = area_of_triangle(x,y)
|
30 |
+
|
31 |
+
st.write ("result is",result)
|