
Understanding Python Dictionaries
Authored by Clarkston Ellerby
Computers
11th Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to create a dictionary in Python with the keys "name", "age", and "courses"?
`student = {"name": "John", "age": 18, "courses": ["Math", "Science", "History"]}`
`student = ["name": "John", "age": 18, "courses": ["Math", "Science", "History"]]`
`student = ("name": "John", "age": 18, "courses": ["Math", "Science", "History"])`
`student = {"name": "John", "age": 18, "courses": "Math, Science, History"}`
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you print the entire dictionary named `student` in Python?
`print student`
`print(student)`
`echo(student)`
`display(student)`
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to access the "name" key from the `student` dictionary?
`student["name"]`
`student.name`
`student->name`
`student.get("name")`
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you access the list of courses from the `student` dictionary?
`student["courses"]`
`student.courses`
`student->courses`
`student.get("courses")`
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to add a new key-value pair for "grade" in the `student` dictionary, where "Math" is the course and 90 is the grade?
`student["grade"] = {"Math": 90}`
`student["grade"] = "Math": 90`
`student.grade = {"Math": 90}`
`student.add("grade", {"Math": 90})`
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If you want to print only the student's age from the `student` dictionary, which of the following would you use?
`print(student["age"])`
`print(student.age)`
`print(student->age)`
`print(student.get("age"))`
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements will correctly update the student's age to 19 in the `student` dictionary?
`student["age"] = 19`
`student.age = 19`
`student->age = 19`
`student.set("age", 19)`
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
Computer Science Principles Unit 1 Quiz
Quiz
•
9th - 12th Grade
12 questions
Информатика
Quiz
•
11th Grade
15 questions
SOAL KOMPUTER KELAS 8 SEMESTER GANJIL
Quiz
•
7th - 12th Grade
10 questions
Review Quiz #2- Productivity Tools
Quiz
•
11th - 12th Grade
15 questions
Python Programming
Quiz
•
5th Grade - University
10 questions
IGCSE Computer Science - Input Devices
Quiz
•
9th - 11th Grade
15 questions
Learning SQL
Quiz
•
11th - 12th Grade
10 questions
Data Handling in Python
Quiz
•
11th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade