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.