CSC108H1 Lecture Notes - Lecture 5: While Loop, For Loop
yifanyang and 39659 others unlocked
21
CSC108H1 Full Course Notes
Verified Note
21 documents
Document Summary
What to count and how to count. What statements to repeat (gives the loop body) What condition causes you to stop the repetition. What is the function going to return. For loop: know exactly how many times it will be repeated. While loop: while condition is not satisfied . Lists can be indexed and sliced: e. g. grades [0:2] = [80, 90] Len (list): return the number of items in list. Min (list): return smallest number [or letter that comes first in dictionary] Max (list): return largest number [or letter that comes last] Sum (list): sum of items in list [must be numeric] List. append (object): append object to the end of the list. List. extend (list): add in items in the list parameter to the list (must add list so put in square brackets) List. pop (): removes and returns the item at the end of the list (can add index to remove specific object) List. remove (object): remove the first occurrence of object.