-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuction using menu.py
64 lines (59 loc) · 2.27 KB
/
fuction using menu.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#find area,perimeter of polygon
import math
PI=math.pi
def c_area(r):
return PI*r*r
def c_perimeter(r):
2*PI*r
def rect_area(l,b):
return l*b
def rect_perimeter(l,b):
return 2*(l+b)
polygon=' '
while ( polygon !='exit'):
print("\npolygon\ncircle\nrectrangle\nexit")
polygon=input("Enter the properties of polygon or exit: ")
properties=' '
if (polygon=="circle"):
r=float(input("Enter the value of radious:"))
while (properties==' '):
print("\ncircleproperties\narea\nperimeter\nback")
properties=input("Enter the properties of circle or go back:")
if (properties=="area"):
circle_area=c_area(r)
print(f'\n the area of circle with given {r} ={circle_area} meter')
properties=''
elif(properties=="perimeter"):
circle_perimeter=c_perimeter(r)
print(f'\n the perimeter of circle with given {r}={circle_perimeter}sq. meter')
properties=''
elif(properties=="back"):
print("back")
break
else:
print("please enter the value proprties again")
properties=' '
elif(polygon=="rectrangle"):
l=float(input("Enter the velue of lenth:"))
b=float(input("Enter the value of breath:"))
while(properties==" "):
print("\nrectrangle\narea\nperimeter\nback")
properties=input("Enter the properties of rectrangle:")
if (properties=="area"):
rectangle_area=rect_area(l,b)
print(f'\n the area of rectangle with {l} and {b}={rectangle_area} sq.meter')
properties=' '
elif(properties=='perimeter'):
rectangle_perimeter=rect_perimeter(l,b)
print(f'\n the perimeter of rectrangle with {l} and {b}={rectangle_perimeter} meter')
properties=' '
elif(properties=="back"):
print("back")
break
else:
print("Kindly Enter the properties again")
properties=' '
elif(polygon=="exit"):
break
else:
print("kindly enter the polygon again")