Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def tri_area(base,height):
- BXH = base * height
- calc_area = BXH / 2 # calc_area is local so can only be accessed inside the tri_area() function
- return calc_area # to output the value of calc_area the value is returned
- area = tri_area(int(input("Please enter the base of the triangle. ")), int(input("Please enter the height of the triangle. "))) #Asks the user for custom dimensions, and stores them as integers
- print("The area of the triangle is:", area) #Outputs the custom dimensions
Advertisement
Add Comment
Please, Sign In to add comment