548 B
548 B
title, type, language, tags, cover, dateModified
| title | type | language | tags | cover | dateModified | |
|---|---|---|---|---|---|---|
| List includes any values | snippet | python |
|
forest-balcony | 2020-11-02T19:28:05+02:00 |
Checks if any element in values is included in lst.
- Check if any value in
valuesis contained inlstusing aforloop. - Return
Trueif any one value is found,Falseotherwise.
def includes_any(lst, values):
for v in values:
if v in lst:
return True
return False
includes_any([1, 2, 3, 4], [2, 9]) # True
includes_any([1, 2, 3, 4], [8, 9]) # False