Value present in a list
Input
([1, 2, 3], 2)
Output
True
2 is in the list, converting to a set keeps 2 and membership check returns True.
Full lesson preview
Use a set to perform fast membership checks.
Problem statement
Task
Examples
Input
([1, 2, 3], 2)
Output
True
2 is in the list, converting to a set keeps 2 and membership check returns True.
Input format
Output format
Constraints
Samples
Input
([1, 2, 3], 2)
Output
True
2 is present in the collection.