ICS 31 • UC Irvine
Python Details in ICS 31
This page lists the specific Python language features typically covered in ICS 31. These features might appear on the ICS 31 Placement Exam. The exam will emphasize concepts and how to apply them more than small syntactic details.
Statements: assert, assignment
Control structures: simple sequence, selection (if/elif/else), repetition (for, while; break, continue; n-and-a-half pattern with while loops), modularity (function definition, calling, return, parameter passing)
Data types and structures: Single-valued (int, float, bool), multiple-valued (string, list, tuple, namedtuple, file, dict, set). Combining data structures (2D tables [list of lists], lists containing namedtuples, namedtuples containing lists). Summary table.
Operations, functions, and methods: Arithmetic (
+ – * / % //), comparison (
< <= == >= > !=), logical (
and or not), sequences (
+ * in, indexing with
[ ], slicing with
[a:b]). Common functions and methods: len() input() print() range() int() float() str() set() randrange(). Lists/sequences: list() append() extend() sort() sorted() count(). Namedtuples: namedtuple() _replace(). Strings: split() strip() upper() lower() format() maketrans() translate() replace(). Files: open() read() readline() readlines() write() close(). Sets: add().
Algorithms: Traversing a list, changing each item (mapping); traversing a list, collecting selected items (filtering), traversing a list, accumulating a single value, e.g., counting or summing (reducing/folding). Finding the largest or smallest or average.