CSCI 1105 Lecture Notes - Lecture 13: Chart Attack
CSCI 1105 verified notes
13/25View all
Document Summary
Loops can occur inside of loops, the same way that we can nest if statements. All you need to do is indent the code block. A good example is of processing cells in a table. We can see this apply to many different things as well. The outer loop iterates all of the rows, and the inner loops process the columns in the current row. Decide how many rows are in the table. Decide how many columns are in the table. Print a table header that contains x1,x2,x3, and x4. Print a table with four columns and ten rows that contain the powers of x1,x2,x3 and x4. (for x = 1 10) In our example there are 10 rows in the table, and 4 columns in the table. for row in range(1,11): This is the most efficient way to determine what you need to know for your program. Test it by putting in your variables and determining the output.