-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtriangle area.py
More file actions
34 lines (32 loc) · 1.06 KB
/
triangle area.py
File metadata and controls
34 lines (32 loc) · 1.06 KB
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
def areaTriangle(length, height):
'''
objective:To compute the area of the triangle
input parameters:
length:length of the rectangle
breadth:breadth of the triangle
approach:multiplying length and heigth
return value: area of the triangle
'''
area=(length*height)/2
return area
def main():
'''
objective:To compute the area of the triangle
user inputs:
length:length of rectangle
heigthh:heigth of triangle
approach:use function areatriangle
'''
length=int(input('enter the length of triangle: '))
heigth=int(input('enter the heigth of the triangle: '))
print('id(length): ',id(length))
print('id(heigth): ',id(heigth))
print('id.(areaTriangle): ',id(areaTriangle))
print('areaTriangle',areaTriangle)
print('Length of triangle is: ',length)
print('Height of triangle is: ',heigth)
print('Area of the rectangle: ',areaTriangle(length, heigth))
print('End of output')
if __name__=='__main__':
main()
print('end of program')