Topic 7 - Working with Dictionaries and Sets Flashcards
What type of brackets are used with dictionaries in python?
Curly brackets, i.e. { }
A python dictionary is defined using what two elements?
The two elements are keys and values.
Is a dictionary in python mutable or immutable?
A dictionary is mutable
What function would you use to determine how many key/values pairs are in the dictionary “bike_details”
len(bike_details)
What function is used to remove all key/values pairs from a dictionary?
Use the function clear, i.e. bike_details.clear()
How would you delete a dictionary entirely?
del bike_details
Why would you use a set in python?
It you needed to contains values where no duplicates are allowed.
Is a tuple mutable or immutable?
It is immutable, i.e. it can not be changed.