Dict has key from list

dictionary, list, python

Solution

Assuming you are talking about python, an alternate method of doing this would be:

return len([x for x in myList if x in myDict]) > 0

Problem

How can I determine if any of the list elements are a key to a dict? The straight forward way is, ``` for i in myList: if i in myDict: return True return False ``` but is there a faster / more concise way?

Original source

Related problems