Practice What Is A Dictionary? (23.1.5) - Tuples and dictionaries - Data Structures and Algorithms in Python
Students

Academic Programs

AI-powered learning for grades 8-12, aligned with major curricula

Professional

Professional Courses

Industry-relevant training in Business, Technology, and Design

Games

Interactive Games

Fun games to boost memory, math, typing, and English skills

What is a Dictionary?

Practice - What is a Dictionary?

Learning

Practice Questions

Test your understanding with targeted questions

Question 1 Easy

Define a dictionary for three fruits with their colors.

💡 Hint: Think of using fruit names as keys and their colors as values.

Question 2 Easy

What type of data can be used as keys in a dictionary?

💡 Hint: Remember: NO lists as keys.

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

What would happen if you accessed a non-existent key in a dictionary?

KeyError
None
Default

💡 Hint: Think about how dictionaries manage their keys.

Question 2

Can keys in a dictionary be other dictionaries?

True
False

💡 Hint: Remember the rule about keys!

1 more question available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Create a function that accepts a dictionary and returns the sum of all its numerical values.

💡 Hint: Make sure to check that all values are numbers before summing.

Challenge 2 Hard

Design a nested dictionary to track a class of students with their subjects and grades, then write a function to calculate their average grade.

💡 Hint: Consider how to extract each student's grades within the nested structure.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.