CSCA08H3 Lecture 5: week5
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.