Quiz
Dictionaries & Sets Quiz
Which of the following is a correct way to create a dictionary?
person = ['name', 'Alice']
person = {'name': 'Alice', 'age': 25}
person = ('name', 'Alice')
person = {'Alice', 25}
What will the below code print?
2
3
Error
None
Which statement about sets is TRUE?
Sets can contain duplicate items
Sets are ordered
Sets are mutable and store unique elements
Sets allow indexing
What will the below code output?
{1, 2, 3, 4, 5}
{3}
{1, 2, 3}
Error
How do you access a value in a dictionary with key 'name'?
dict.name
dict['name']
dict.get('value')
dict(name)