Advertisement
Grafundzijus

Triangle area

Apr 22nd, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. # Create a function that asks the user for the height and base of a triangle,
  2. # and then calculates and prints out its area.
  3.  
  4. triangle_height = float(input('height = '))
  5. triangle_base = float(input('base = '))
  6.  
  7. def triangle_area(triangle_height, triangle_base):
  8.     return triangle_height * triangle_base / 2
  9.    
  10. print(triangle_area(triangle_height, triangle_base))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement