ITI 1120 Chapter Notes - Chapter 9: Infinite Loop, Lithium Chloride, Sodium Bromide

47 views6 pages

Document Summary

Repeating code using loops: this chapter introduces another fundamental kind of control flow, repetition. Lists are invented so that you wouldn"t have to create a thousand variables to store a thousand values. For the same reason, python has a for loop that lets you process each element in a list in turn without having to write one statement per element. The general forms of a for loop over a list is as follows: Finally, the loop variable is assigned the last item of the list and the loop body is. The loop variable is then assigned the second item in the list and the loop body is for variable in list : block a for loop is executed as follows: The loop variable is assigned the first item in the list, and the loop block the body of the for loop is executed. executed again. executed one last time.

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