CMPT 120 Lecture : Mutability

41 views1 pages
meghan78 and 39786 others unlocked
CMPT 120 Full Course Notes
29
CMPT 120 Full Course Notes
Verified Note
29 documents

Document Summary

Data structures that can be modified inplace like this are mutable mystr = mystr + x , others are immutable, so are dictionaries, sets, objects (if they have methods that modify. Lists are mutable: so are numbers, boolean, tuples , objects (without modifying instances, strings are immutable methods eg. card, date, consider these statements: string = string + x list = list + [0] list. append(0) Mutability mylist[3] = xyz mylist. append(18: strings can"t do this. Lists are the only type we"ve seen that can be changed without totally rebuilding.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions