scipiguy

Python 102: My triangle area function

Apr 22nd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. # Futurelearn RPi course: Python 102 - Week 1 Function
  2.  
  3. def area_of_triangle(base, height):
  4.     area = 0.5 * base * height
  5.     return area
  6.  
  7. base = float(input("Enter the triangle base length: "))
  8. height = float(input("Enter the triangle height: "))
  9.  
  10. area = area_of_triangle( base, height )
  11. print ("The area of the triangle is " + str(area))
Advertisement
Add Comment
Please, Sign In to add comment