Class Notes (839,387)
Canada (511,321)
CSC108H1 (113)

october 17 notes

2 Pages

Computer Science
Course Code
Michelle Craig

This preview shows 80% of the first page. Sign up to view the full 2 pages of the document.
 Suppose we want a list of adjectives describing someone >>> adjectives_1 = [“disagreeable”, “smart”, “funny”, “distracted”, “pretty”] >>> adjectives_2 = [“helpful”, “tall”, “funny”, “smart”, “polite”] >>> adjectives_3 = [“musical”, “funny”, “frustrating”, “smart”] >>> description_1 = [„diane‟, adjectives_1] >>> description_2 = [„my_ta‟, adjectives_2] >>> description_3 = [„dan‟, adjectives_3] #first time is a string, second item a list >>> description 1 [„diane‟, [“disagreeable”, “smart”, “funny”, “distracted”, “pretty”]] >>> description_1[0] „diane‟ >>> description_1[1] [“disagreeable”, “smart”, “funny”, “distracted”, “pretty”] >>> description_1[1][2] „funny‟ >>> description_1[1][0] = „cooperative‟ >>> description_1 [„diane‟, [“cooperative”, “smart”, “funny”, “distracted”, “pretty”]] >>> descriptions = [description_1, description_2, description_3] [„diane‟, [“disagreeable”, “smart”, “funny”, “distracted”, “pretty”]], [„my_ta‟, [“helpful”, “tall”, “funny”, “smart”, “polite”]], [„dan‟, [“musical”, “funny”, “frustrating”, “smart”]] >>> descriptions[2] [„dan‟, [“musical”, “funny”, “frustrating”, “smart”]] >>> descriptions[2][1] [“musical”, “funny”, “frustrating”, “smart”] >>> descriptions[2][1][2] „frustrating‟ >>> descriptions[2,1] #error >>> for i in [0,1,2,3,4]: #print list of adjectives diane … print description[0][1][index] … cooperative smart funny distracted pretty >>> for item in descriptions[0][1]: #also print list of adjectives associated with diane … print item … cooperative smart funny distracted pret
More Less
Unlock Document

Only 80% of the first page are available for preview. Some parts have been intentionally blurred.

Unlock Document
You're Reading a Preview

Unlock to view full version

Unlock Document

Log In


Join OneClass

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

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.