12
AssignmentMultiple Select

Unit Test

Question 12 • VA-Information Technology Fundamentals B

Which of these are correctly formatted Python dictionaries? Check all that apply.

Answer
A
dict = {‘Name’: ‘Matthew’, ‘Age’: 14, ‘School’: ‘ABC School’};
B
dict = (‘Name’: ‘Mary’, ‘Age’: 13, ‘School’: ‘XYZ School’)
C
dict = [“Programming Basics”, “Introduction to Python”]
D
dict = {‘season’: ‘fall’, ‘weather’: ‘cool’};
E
dict = ’[‘laptop’, ‘computer’, ‘hard drive’]

Explanation

A Python dictionary uses curly braces and stores comma-separated key:value pairs. Choices A and D have that structure, and the semicolon after each assignment is permitted in Python. Choice B uses parentheses instead of braces, C is a list, and E is not a dictionary because it does not contain key:value pairs.

AI-written and checked against the verified answer.

Previous
Next