← Back to the Introduction to Computer Science outline The Course Maker
← Introduction to Computer Science outline
Week 9 · Module overview

Week 9 — Lists

Introduction to Computer Science Free sample edition

Welcome to your Week 9 Start Here page.

Why this matters

A biology major logging a week of plant heights and a small-business owner keeping orders in the order they came in both keep a row of values under one name, and both need to know whether a change shows up everywhere.

In plain language

So far every value in your programs has lived in its own variable, one name per number or string. This week you meet a list (one name that holds a whole row of values, in order), so seven days of reading fit under a single name. You will read any item (one value in the list) by its position, cut out pieces, and change the list after you make it, which a string never allowed. You will also learn the one surprise that trips up almost everyone: giving a list a second name does not make a second list. As always, you predict what each program prints and then run it to check.

  • Already covered: loops, accumulators, and functions that hand back None.
  • This week: lists, slices, list methods, aliases and copies, and a loop trap.
  • How they connect: a list is indexed like a string and walked with a for loop.
  • Where we're going next: Week 10, Tuples, Dictionaries & Sets.

Focus

How do you keep a whole row of values under one name, and know when a change shows up under another name?

By the end of this module, you should be able to:

  • [ ] read a list by index and slice it
  • [ ] predict what each list method hands back
  • [ ] tell an alias from a copy

To-do

Plan your week

  1. Read Chapter 9 (about 45 minutes), then the lecture and slides.
  2. Work the lecture tutorial (60–90 minutes) and the practice set (about 20 minutes).
  3. Do the Coding Lab (about 90 minutes), the discussion, and the assignment.
  4. Take the quiz.

This week's checkpoint: predict what a second name for a list shows after a change, then run it to check.

You've got this

Predict, then run, and ask your instructor if a step snags.

Built with The Course Maker · samples.thecoursemaker.com