Facebook
From Wiktor, 2 Months ago, written in Python.
Embed
Download Paste or View Raw
Hits: 34
  1. def czy_to_trojkat(a, b, c):
  2.     return a + b > c and b + c > a and c + a > b
  3.  
  4. def czy_to_trojkat_prostokatny(a, b, c):
  5.     if not czy_to_trojkat(a, b, c):
  6.         return False
  7.     if c > a and c > b:
  8.         return c ** 2 == a ** 2 + b ** 2
  9.     if a > b and a > c:
  10.         return a ** 2 == b ** 2 + c ** 2
  11.  
  12. print(czy_to_trojkat_prostokatny(5, 3, 4))
  13. print(czy_to_trojkat_prostokatny(1, 3, 4))