Advertisement
Fareehausman00

Returning the area of triangle

Sep 21st, 2019
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. # Function to accept dimensions of a triangle and return its area.
  2.  
  3. # Offering some instructions
  4. print("After you give me the base and the height of a triangle, ")
  5. print("I'm going to reply with the triangle's area...")
  6. print(" ")
  7. height = int(input("What is the height of the triangle? "))
  8. base = int(input("What is the base of the triangle? "))
  9. print(" ")
  10.  
  11. # Defining the function for finding the area of a triangle
  12. def triangle(height, base):
  13. area = (height * base) / 2
  14. return area
  15.  
  16. # Saving the value returned by the function
  17. area = triangle(height, base)
  18.  
  19. # Printing the results
  20. print("The area of the triangle is... ")
  21. print(area)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement