COMPSCI 61A Lecture Notes - Lecture 10: Backslash, Concatenation

20 views4 pages
zogo39484755 and 6 others unlocked
COMPSCI 61A Full Course Notes
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents

Document Summary

Create a list, create list literal: [41, 43, 47, 49] To bind it to name, assignment statement. Can write expressions as parts of a list. Built in operators for testing whether an element appears in a compound value. Digits = [1, 8, 2 ,8 ] In does not look for subsequences, looks for individual elements. Count the number of times that value occurs in sequence s. Evaluate the header , which must yield an iterable value (a sequence) For each element in that sequence, in order: Bind to that element in the current frame. >>> pairs = [[1,2], [2, 2], [3, 2], [4, 4]] Range is a sequence of consecutive integers. Both indices point to just before each number. Range(-2, 2) goes from -2 to 1. Computing length of of a range: 2-(-2) = 4. Easy for iteration from 1 n. [x for x in odds if 25 % x == 0]

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions