-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1area.py
33 lines (28 loc) · 941 Bytes
/
1area.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
# Program for Calculating the area of a Circle, Rectangle and Square
# 1. Area of Circle
def circle():
radius = float(input("\nEnter the Radius of Circle : "))
return 3.14*radius*radius
# 2. Area of Square
def square():
side = float(input("\nEnter the Side of Square : "))
return side*side
# Area of Rectangle
def rectangle():
length = float(input("\nEnter the Length of Rectangle : "))
breath = float(input("Enter the Breath of Rectangle : "))
return length*breath
while(True):
print("\nChoose shape for area calculation :")
print("1. Circle\n2. Rectangle\n3. Square\n4. Exit(Any Key)")
choice = input("Enter your choice : ")
if(choice=='1'):
result = circle()
elif(choice=='2'):
result = rectangle()
elif(choice=='3'):
result = square()
else:
print("Exit")
exit()
print("Area of shape is",result)