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
0 1 2 3 0 5473 1 4897 2 5123 3 4129 4 6780
Each row, col has a value
Images
0 1 2 3 4 5 6 7 8 9 10 1112
0
1
2
3 4
Each row, col has
5
an RGB value
6
7
8
9
10
11
12
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 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