‘in’ keyword is used to check for the existence of an element in the list.
Syntax
element in list
Example
10 in first_5_primes
Above statement return True, if 10 is in first primes list, else False.
>>> first_5_primes = [2, 3, 5, 7, 11]
>>>
>>> 10 in first_5_primes
False
>>>
>>> 11 in first_5_primes
True
No comments:
Post a Comment