'''calculates square roots, format input as (number of decimals, root)'''
INPUT = [
    (0, 7720.17),
    (1, 7720.17),
    (2, 7720.17),
    (0, 12345),
    (8, 123456),
    (1, 12345678901234567890123456789)]

def findroot(num):
    '''finds root of the given number'''
    upper = 1
    lower = 0
    while lower != upper:
        lower = upper
        upper = ((num/upper) + upper) / 2
    return upper

def main():
    '''goes through each item in the input and prints the results'''
    for inputno in INPUT:
        sol = findroot(inputno[1])
        print(format(sol, '.{}f'.format(inputno[0])))

if __name__ == '__main__':
    main()