Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Python 102 1 7 Challenge
- ''' Create a _function_ that accepts the dimensions of a triangle and _returns_ its area.
- Note: The formula for the area of a triangle is base*height/2 '''
- def tarea():
- base = float(input(" input triangle Base dimension : "))
- print("You entered : ", base)
- height = float(input("input triangle Height dimension : "))
- print("You entered : ", height)
- area = (base * height)/2
- # print("Triangle area is: ", area)
- return area
- a = tarea()
- print("Area =", a)
- # Note: there is no error handling; as for strings or negative numbers !
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement