Properties of a Python set
- Items are not ordered
- Items are not changeable – they can only be added/removed
- Items are not indexed
Are Python sets ordered?
No
Are items in a Python set changeable?
No, they can only be added/removed from the set
Are items in a Python set indexed?
No
Python dict.get() vs dict[key]
dict[key]returns the value or raisesKeyErrorif the key is missing.dict.get(key, default)returns the value ordefaultif missing; the default isNonewhen omitted.