# cPy - Theorem of Pythagoras
# Provided by anthony Vogelaar
# rev 0.10  2025-02-20  initial release

import  os;     os.system('clear')
import  math

def main():
    print('Theorem of Pythagoras')
    print('   enter 0 for leg to calculate\n')
    legs = []
    legs.append(input('a - rectangle leg: '))
    legs.append(input('b - rectangle leg: '))
    legs.append(input('c - hypotenuse   : '))
    legs_sq = [float(leg)**2 for leg in legs]
    if legs_sq[2]:
        z = legs_sq[2] - legs_sq[0] - legs_sq[1]
    else:
        z = legs_sq[0] + legs_sq[1]
    print('the requested leg is:', end=' ')
    print(f'{math.sqrt(z):.4f}')

main()
