This article is interactive. You can change its parameters and see the results live. ⚡️

Pythagorean theorem calculator

Fill in the known sides and keep the one you wish to calculate empty.

a

b

c

from math import sqrt
if c =='':
a =int(a)
b =int(b)
result = sqrt(a * a + b * b)print(f'The length of side C is: {result}')elif b =='':
a =int(a)
c =int(c)
result = sqrt(c * c - a * a)print(f'The length of side B is {result}')elif a =='':
b =int(b)
c =int(c)
result = sqrt((c * c)-(b * b))print(f'The length of side A is {result}')else:print('Please left an empty field to calculate it')