Menu

gitpiper

includes_any python Code Snippet in 2024

listintermediate

Last Updated: 20 April 2024

Checks if any element in values is included in lst.

  • Check if any value in values is contained in lst using a for loop.
  • Return True if any one value is found, False otherwise.
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

python snippet similar to includes_any For You in April 2024

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2024 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️