2nd Semester Intro to Computer Science

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)

In your Notebook

Write down any bugs that you see in the 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)

Cointinue in your Notebook

Write down any bugs that you see in the program.

3. In your Console

Type and fix the two above programs

Edit this page Report an issue