Lists
Students will...
- be able to use the terms list and elements properly.
- be able to create lists using the literal method:
e.g., cheeses = ['cheddar', 'jarlsberg', 'Venezuelan beaver cheese']
- be able to discuss sublists and nested lists.
- understand the difference between creating a list and indexing into a list.
- be able to write code using in and not in on lists.
- understand using + with lists.
- be able to use slicing to create a new list from an existing list.
- discuss the implications of the fact that a list is mutable.
- understand aliasing.
- be able to use the methods
append()
, extend()
, insert()
, pop()
, sort()
, count()
.
- be able to write code to do an index-based or item-based traversal of a list.
- be able to use lists as parameters, return values, etc.
- be able to use
split()
to split a string into a list of strings.
- understand how a tuple differs from a list.
- be able to write code to use multiple-assignment using a tuple.
- be able to write code to return a tuple from a function, and capture those return values in a tuple of variables.