Lecture 5 Flashcards
Sets
Are unordered collections of unique elements defined using curly brackets.
What happens with duplicates in a set?
Duplicate element in asset will not result in an error, but they will not be stored
Can you change sets after the created?
No sets cannot be changed, but they can be added or removed
Dictionaries
Dictionaries are ordered collections of key value pairs defined using curly brackets. Keys must be unique, but values can be duplicated. He can be strings numbers or temples. Values are changeable and can be any data type.
How are values in dictionary accessed
With square brackets and they associated key.
How to remove values from sets
Use
.remove()
or
.discard()
Can disctionaries be nested
Yes
Do dictionaries need to be explicitly copied
Yes, to avoid conflict