lamiastella

is_triangle

Jun 22nd, 2016
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. def is_triangle(a, b, c):
  2.     sides = [a, b, c]
  3.     for x, y, z in sides:
  4.         if x + y < z:
  5.             return False
  6.         if abs(x - y) > z:
  7.             return False
  8.     for side in sides:
  9.         if side <= 0:
  10.             return False
  11.     return True
  12.  
  13. print(is_triangle(7, 2, 2))
Advertisement
Add Comment
Please, Sign In to add comment