Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- a = int(input("A: "))
- b = int(input('B: '))
- c = int(input("C: "))
- def checkValidity(a, b, c):
- if (a + b <= c) or (a + c <= b) or (b + c <= a):
- return False
- else:
- return True
- def triangle(a, b, c):
- if checkValidity(a, b, c) == 0:
- print("This is not a triangle")
- else:
- P = a + b + c
- P2 = P/2
- S = math.sqrt(P2 * (P2 - a) * (P2 - b) * (P2 - c))
- print("Perimeter: " + str(P))
- print("Areas: " + str(S))
- triangle(a, b, c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement