CSE 1010 Lecture 11: Nested Loops part 1

17 views3 pages
Verified Note

Document Summary

Farmer has to plant a seed in every square in a 4x3 acre eld. Change each square to a 1: go 1 row at a time, 1 square at a time per row. Store the eld in python so that we can change the value of each square from 0 to 1: f1 is a list of lists. Plantfield calls the plantrow function, and the plantrow function calls the plantsquare function: eld, rownum, and colnum need to be de ned in order for the functions to work. The f1 list has 3 terms, each of which is a list that themselves has 4 terms; len(f1) is 3 even though the eld has 12 squares: plantrow. We know what eld and what row, now we need to plant each square in that row: in order to call plantsquare, colnum still needs to be de ned.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents