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

  1. Debugging challenge S0 4246S

    Find and explain the bugs in the following Python program:

    product = 1
    i = 1
    def factorial(n):
        while i <= n:
            product = product * i
        return product
    
    print('1! =', factorial(1))
    print('2! =', factorial(2))
    print('3! =', factorial(3))
    

    Your solution must not only fix the program, but also must explain what bugs were present.