Source Code:
(back to article)
# Define the list my_list = [1, 2, 3, 4, 5] # Define the element to search for search_element = 3 # Use the 'in' keyword to check if the element is in the list if search_element in my_list: print(f"{search_element} is in the list.") else: print(f"{search_element} is not in the list.")
Result:
Report an issue