Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- print("Enter 3 side lengths.")
- x = float(input("Side one: "))
- y = float(input("Side two: "))
- z = float(input("Side three: "))
- if x + y > z and x + z > y and y + z > x:
- half_perimeter = (x + y + z) / 2
- area = math.sqrt(half_perimeter * (half_perimeter - x) * (half_perimeter - z) * (half_perimeter - y))
- print(f"The three sides can make a triangle, and it's area is {area}.")
- else:
- print("It's not possible to make a triangle out of the given sides.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement