CP104 Lecture 7: 2D List

52 views2 pages
School
Course
Professor
Last Two Questions two D lists
- 2d matrix
- Group data together with one name and use indexing to access element
- List triangular
- Nested for loops to print elements of two d lists
- Initialize list with empty list and append and put into two d list
- result=[]
- temp=[]
- result.append(temp)
- #Append empty lists in first two indexes.
- elements.append([])
Need to specify what empty list to put inside
Ways to fill two d lists
- results=[][
- For i in range (3):
- results.append([]) or temp=[]
- For j in range (3):
- Temp.append (0)
result.append(temp)
- Find highest number in 2d list
- Other list initialized two for loops
>> get average of rows and columns (separate)
Def get_av(handle_n):
rows=int(handle_in.readline())
cols= int(handle_in.readline())
std_2d=[]
For r in range(rows):
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in
hayjayshay and 38575 others unlocked
CP104 Full Course Notes
2
CP104 Full Course Notes
Verified Note
2 documents

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