Teoremă Pitagora

Teoremă Pitagora

# Teorema Pythagora: c2 = a2 + b2

def function1(a, b, c):
      return a + b > c and b + c > a and c + a > b  
def function2(a, b, c):
       if not function1(a, b, c):
        	return False
       if c > a and c > b:
        	return c ** 2 == a ** 2 + b ** 2
       if a > b and a > c:
        	return a ** 2 == b ** 2 + c ** 2

print(function2(5, 3, 4))	# nici o conditie pitagoreana
# rezultat: True
print(function2(1, 3, 4))	# nu poate fi triunghi
# rezultat: False