Lecture 14: Nested Lists, Tuples, and Dictionaries
Lecture 14: Nested Lists,
Tuples, and Dictionaries
(Sections 11.1-11.5, 12.1-12)
CS 1110
Introduction to Computing Using Python
[E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van Loan, W. White]
Announcements
? A3 Tentative release date: Mon Mar 19-Thu Mar
22; tentative time for completion: somewhere
between 1 and 2 weeks. Similar to A3 from
Spring 2017.
? Prelim 1 Grading this weekend. Grades will
come out before the drop deadline.
2
Next week: Recursion
? Tuesday and Thursday: Recursion.
? Reading: 5.8-5.10
3
Nested Lists
? Lists can hold any objects
? Lists are objects
? Therefore lists can hold other lists!
b = [3, 1]
c = [1, 4, b]
a = [2, 1]
x = [1, a, c, 5]
x[1]
x[2]
x[2][2]
x = [1, [2, 1], [1, 4, [3, 1]], 5]
x[0]
x[1][1]
x[2][0]
x[2][2][0]
4
Two Dimensional Lists
Table of Data
Images
0 1 2 3
0 5 4 7 3
1 4 8 9 7
2 5 1 2 3
3 4 1 2 9
4 6 7 8 0
0 1 2 3 4 5 6 7 8 9 10 1112
Each row, col
has a value
0
1
2
3
4
5
6
7
8
9
10
11
12
Each row, col has
an RGB value
Store them as lists of lists (row-major order)
d = [[5,4,7,3],[4,8,9,7],[5,1,2,3],[4,1,2,9],[6,7,8,0]]
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- lecture 14 nested lists tuples and dictionaries
- python tutorial stanford artificial intelligence laboratory
- introduction to python
- python problem set
- names assignment sequences types lists tuples and
- python mock test ii rxjs ggplot2 python data
- mit6 0001f16 tuples lists aliasing mutability cloning
- lists tuples files
- use python with r with reticulate cheat sheet
Related searches
- lists of strengths and weaknesses examples
- tuples in python
- ordered and unordered lists html
- money and banking lecture notes
- home organization lists and charts
- add tuples python
- c lists and arrays
- creating a list of tuples in python
- create list of tuples python
- nested lists python 3
- list of tuples python
- bible dictionaries and encyclopedias online