Computational Physics Lab I: Spring-2023
Challenge for Week 5 : Due Week 5

  1. Debugging a square root S0 4247S Please explain why the following program outputs what it does.
    i = 1
    def sqrt(n):
        while i < n:
            if i*i >= n:
                return i
            i = i + 1
    print('sqrt(10) is', sqrt(10))
    print('i is', i)