1/13
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No study sessions yet.
T/F Sets are ordered like lists
False. Sets are unordered elements
What does this code do?
set1.update(set2)
Adds the values from set 2 to the end of set 1
What does this line of code do"?
set1.intersection(set2)
It creates a new set that only holds the overlapping values between the sets
What does this line of code do?
set1.union(set1,set2,set3)
Creates a set of the elements that did not overlap between the sets
Dictionaries consist of __and _
key, values
What causes a runtime error?
Referencing a key that does not exist in the dictionary
How does .items() affect a dictionary?
It allows iteration through the entire dictionary as if it was a list. There is no longer a distinction between keys and values
T/F When you print a dictionary, only the keys/values print.
False. When dictionaries print, there, parenthesis are placed around the key:value pair. The colon and quotation marks for strings are printed as well
What is teh difference between tuples and lists?
Tuples are immutable while lists are mutable
Y/N Can you pass a list through a tuple? What about a set
Yes you can. If passed through a tuple, it becomes immutable.
.append(), .extend(), .remove(), .insert() are for what data type?
Lists
.add(), .remove(), .discard(), .update is for what data type?
Sets