COMPSCI 61A Lecture 10: CS 61A LEC 10
19 views2 pages
29 Nov 2016
School
Department
Course
Professor
zogo39484755 and 6 others unlocked
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents
Document Summary
[-1, 0, 1, 2, 3, 1, 2, 3] Built-in operator for testing whether an element appears in a compound value. (performs a loop on each element in the given list) Evaluate the header , which must yield an iterable value (a sequence) A. bind to that element in the current frame. Given a name for each element in a fixed-length sequence. A range is a sequence of consecutive integers range(a, b) returns a range from a inclusive to b exclusive. Element selection: starting value + index list(range(a, b)) returns a list with the elements of range(a, b) range(b) returns a range from 0 inclusive to b exclusive. [ if else for in list] Equivalent to using single or double quotes with \n to break up lines. Length and element selection are similar to all sequences. However the "in" and "not in" operations match substrings. Returns a list of the keys of dict.