CSC108H1 Lecture Notes - Html Element
yifanyang and 39659 others unlocked
21
CSC108H1 Full Course Notes
Verified Note
21 documents
Document Summary
Suppose we want a list of adjectives describing someone. >>> adjectives_1 = [ disagreeable , smart , funny , distracted , pretty ] >>> adjectives_2 = [ helpful , tall , funny , smart , polite ] >>> description_3 = [ dan , adjectives_3] #first time is a string, second item a list. [ diane , [ disagreeable , smart , funny , distracted , pretty ]], [ my_ta , [ helpful , Tall , funny , smart , polite ]], [ dan , [ musical , funny , frustrating , smart ]] >>> 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 pretty. >>> for item in descriptions[0][1]: #suppress separate line. Print item, cooperative smart funny distracted pretty. >>> for item in description[2][1]: #only for access list, not change item.