CSC108H1 Lecture Notes - Lecture 5: While Loop, For Loop

59 views2 pages
10 Apr 2016
School
Course
yifanyang and 39659 others unlocked
CSC108H1 Full Course Notes
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.

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