timpin

Untitled

Aug 20th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. def area(): #calculate the area of a triangle
  2. print("Let's caclulate the area of a triangle")
  3. base = input("What length is the base of the triangle? ")
  4. height = input("What is the height perpendicular to the base? ")
  5. b = float(base)
  6. h = float(height)
  7. area = b * h /2
  8. output = str(area)
  9. print("Area of a triangle with base "+base+" and height "+height+" = "+output)
  10.  
  11. area()
Advertisement
Add Comment
Please, Sign In to add comment