Lab 4.05 - Debugging Practice

  1. Read through the following code:

     def my_looping_function(list): 
         for i in range(1, len(list)+1): 
             print list[i]
    
     basic_list = [1, 2, 3, 4, 5, 6]
     my_looping_function(basic_list)
    

    Write down any bugs that you see in this program.



  2. Read through the following code:

     def my_nested_looping_function(a_list): 
         for i in range(0, len(a_list)): 
             value = a_list[a]
             for j in range(0, i): 
                 value += j 
             print value    
    
     basic_list = [1, 2, 3, 4]
     my_nested_looping_function(basic_list)
    

    Write down any bugs that you see in this program.


  3. Go to the computer, type and fix the two above programs.