Computational Physics Lab I: Fall-2022
Challenge for Week 8: Due Week 8 (Nov 14 and 16)

  1. Debugging a square root 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)