Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Function to accept dimensions of a triangle and return its area.
- # Offering some instructions
- print("After you give me the base and the height of a triangle, ")
- print("I'm going to reply with the triangle's area...")
- print(" ")
- height = int(input("What is the height of the triangle? "))
- base = int(input("What is the base of the triangle? "))
- print(" ")
- # Defining the function for finding the area of a triangle
- def triangle(height, base):
- area = (height * base) / 2
- return area
- # Saving the value returned by the function
- area = triangle(height, base)
- # Printing the results
- print("The area of the triangle is... ")
- print(area)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement