Bug-Fixing Exercise 1

The programmer is trying to loop over the buttons list and print out each item with the first letter capitalized. However, the programmer has done something wrong. Try to find and fix the issue.

for i in buttons:
    print(i.capitalize())

buttons = ["cancel", "reply", "submit"]

Solution


Bug-Fixing Exercise 2

The programmer is again missing something in the code. Try to find what it is and fix it.

buttons = ["cancel", "reply", "submit"]

for i in buttons:
print(i.capitalize())

Solution


Bug-Fixing Exercise 3

The code below is supposed to print out the items of the list with the first character of each item capitalized. However, the code contains two errors. Try to find and fix the errors.

for item in ["sandals", "glasses", "trousers"):
    print(item.capitalize)

Solution