Python Dict Comprehension Exercises
Let’s check out some exercises that will help understand Dict Comprehension better.
Exercise 17-a
Create a dictionary from the list with same key:value pairs, such as: {"key": "key"}.
Exercise 17-b
First, create a range from 100 to 160 with steps of 10.
Second, using dict comprehension, create a dictionary where each number in the range is the key and each item divided by 100 is the value.
Exercise 17-c
Using dict comprehension and a conditional argument create a dictionary from the current dictionary where only the key:value pairs with value above 2000 are taken to the new dictionary.
Need More Exercises?
Check out Holy Python AI+ for amazing Python learning tools.
*Includes 14 more programming languages, inspirational tools and 1-on-1 consulting options.
*Includes 14 more programming languages, inspirational tools and 1-on-1 consulting options.

Umut Sagir
Finance & Data Science Professional,
Founder of HolyPython
Founder of HolyPython