Skip to content

Commit 5151293

Browse files
authored
Merge pull request #72 from bonifasiustrg/main
Shape-Area
2 parents e14a2ae + 1d6e043 commit 5151293

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
shape=str(input("choose what shape are you looking for [circle/around, triangle, rectangle]:"))
2+
3+
while shape:
4+
if shape=="circle" or shape=="around":
5+
r=float(input("type what is the radius of the circle (in cm):"))
6+
if r%7==0:
7+
Area=(22/7)*r**2
8+
elif r%7!=0:
9+
Area=3.14*r**2
10+
print("So, area of a circle with radius", r, "is","{:2}".format(Area),"cm^2")
11+
print("DONE")
12+
elif shape== "triangle":
13+
h=float(input("type what is the height of the triangle (in cm):"))
14+
s=float(input("type what is the length of the base of the triangle (in cm):"))
15+
Area= 1/2*h*s
16+
print("So, area of a triangle with height",h,"and length",s,"is","{:2}".format(Area),"cm^2")
17+
print("DONE")
18+
elif shape=="rectangle":
19+
l1=float(input("type what is the length of the rectangle (in cm):"))
20+
l2=float(input("type what is the width of rectangle (in cm):"))
21+
Area= l1*l2
22+
print("So, area of a rectangle with length", l1,"and width",l2, "is","{:2}".format(Area), "cm^2")
23+
print("DONE")
24+
else:
25+
print("Error")
26+
print("type the shape in the list")
27+
shape=str(input("choose what shape are you looking for [circle/around, triangle, rectangle]:"))
28+
29+
30+
31+

0 commit comments

Comments
 (0)