Advertisement
zhongnaomi

calculates the area of a triangle. def

Jan 22nd, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. #calculates the area of  a triangle.
  2.  
  3. def triangle_area():
  4.     # asks the user for the height and base of a triangle
  5.     input1 = input(" height of the triangle ")
  6.     input2 = input ("base of a triangle ")
  7.      #and then calculates
  8.     area =float( input1) * float(input2) /2
  9.     #and prints out its area
  10.     print ( "the area of  a triangle is " + str(area) )
  11.    
  12. triangle_area()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement