Skip to main content

Section 3.7 Lists Coding Practice Exercises

45 minutes
This section contains coding practice exercises using lists. Some of these are adapted from the AP CSP and Python for Everybody ebooks by Dr. Barb Ericson.

Activity 3.7.1.

Write code to change the first item in the list weekdays to β€œMonday”, and append β€œFriday” to the end of the list.

Activity 3.7.2.

Write code to change the first item in the list months to β€œFebruary”, to insert β€œApril” between β€œMarch” and β€œMay”, and to remove β€œAugust”.

Activity 3.7.3.

Write code that uses a for loop to traverse the list numbers and prints out 10 times each number.

Activity 3.7.4.

Write code that uses a for loop to go through a list of words and print out the first letter of each word to form an acronym.

Activity 3.7.5.

Write code that uses a for loop to go through a list of temperatures and counts how many days were below freezing (32 degrees).

Activity 3.7.6.

Write code that uses a for loop to go through a list of words and prints out any words that have the substring "cat" in them.
You have attempted of activities on this page.