CSCA08H3 Lecture 5: week5

47 views1 pages

Document Summary

Iteration: docstring must be your own examples/descriptions, each function should have at most one return while loops: Simplest type of loop can do anything the other loops can do. Form: while (condition): block of code: keep executing block of code as long as condition evaluates to true. Perform a series of actions a counter number of times. Performs a series of actions once for each element in a list: great for quickly/easily getting through an entire list of input. Problem/drawback: don"t know where we are in the list at any given time. Form: for element in list: block of code. Explanation: any python (. py) file that is directly executed has the name __main__. This if statement checks if it"s name is __main__, if it is, run the code.

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