Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Calculate the area of a triangle
- #Create a function to calculate the area of a trinagle
- def triangleArea(h, w):
- area=(h*w*0.5)
- return area
- #Input the paramaters
- tHeight = input('Triangle Height: ')
- tWidth = input('Triangle Width: ')
- #convert to floating point numbers
- fHeight = float(tHeight)
- fWidth = float(tWidth)
- #Call the function
- tArea = triangleArea(fHeight, fWidth)
- print('The area of the triangle is = ', tArea)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement