INFO1110 Lecture Notes - Lecture 1: 5,6,7,8, Order Of Merit

83 views1 pages

Document Summary

For a one-dimensional list, we needed to maintain one index. For a two-dimensional list, we need to maintain two indices (a row index and a column index). two_d_list = [ [7, 8, 9], row = 0 while row < len(two_d_list): col = 0 while col < len(two_d_list[row]): elem = two_d_list[row][col] print(elem, end=", ") col += 1 print() # move to new line row += 1. Here s how to do the same thing with python for loops. two_d_list = [ [7, 8, 9], for row in two_d_list: for elem in row: print(elem, end=", ") print() # move to new line.

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