Class Notes (807,524)
CSC108H1 (113)
Lecture

# october 19 notes

1 Page
79 Views

School
University of Toronto St. George
Department
Computer Science
Course
CSC108H1
Professor
Michelle Craig
Semester
Fall

Description
 Boolean and if statements If : Print ‘do something here’ o Ex. If count == 0: Print ‘do something here’ o Ex. graduating = (count == o) If average > 79 and graduating: #graduating is a variable or expression that evaluate to #true/false Print ‘do something’ o ‘0’ = false; all other integer is true o empty string = false; all other stirng is true  more on lists >>> L = [3,4,3,8,10,12] >>> result = L.pop() >>> L = [3, 3, ‘hello’, 6, 8] >>> result >>> L.reverse() 12 >>>L >>> L # List L had last item removed [8, 6, ‘hello’, 3, 3] [3, 4, 2, 8, 10] >>> print L.reverse() >>> L.pop(0) # given index, removes None # string at index >>> print L.sort() # doesn’t print 3 # but still sorts >>> L None [4, 2, 8, 10] >>> L >>> L = [] [3, 3, 6, 8, ‘hello’] >>> L.pop() o L is a list of strs. Return the total length of all strs in L.‘ 1. def total_length(L): 2. total_length = 0 3. for item in L: 4. total_lenght += len(item) 5. return total_length
More Less

Related notes for CSC108H1

OR

Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Join to view

OR

By registering, I agree to the Terms and Privacy Policies
Just a few more details

So we can recommend you notes for your school.