The in Keyword for Membership Testing in Python


Use in to test for membership in sequences, such as lists or strings, and to iterate over dictionaries.

Source Code

if "a" in ["a", "b", "c"]:
    print("Found 'a' in the list.")
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments