Python 1689719949
Python 1689719949
Coding
Problem Statement -
Given a dictionary with a set of keys and
values, how can you create a new dictionary
that only includes key-value pairs where the
value is a list of integers, and the sum of
the integers in the list is greater than a
certain threshold value?
Example -
Let's say we have the following
dictionary:
my_dict = {
"key1": [1, 2, 3],
"key2": [4, 5, 6],
"key3": "hello",
"key4": [7, 8, 9, 10]
}
And let's say our threshold value is 14.
We want to create a new dictionary
that only includes the key-value pairs
where the value is a list of integers and
the sum of those integers is greater
than 14.