In this program, we will take a user input as a list and that if the given element exists in the list or not with the help of the below-given steps.
Element exists in the list:
Steps to solve the program
- Take a list as input.
- Use the membership operator i.e. in or not in to check whether an element exists in the list or not.
- Print the output to see the result.
#Input list
list1 = [22,45,67,11,90,67]
#Printing output
print("Is 67 exsist in list1? ", 67 in list1)
print("Is 15 exsist in list1? ", 15 in list1)
Output :
Is 67 exsist in list1? True
Is 15 exsist in list1? False
Related Articles
Python program to remove all odd index elements.
Python program to take two lists and return true if then at least one common member.
Python program to convert multiple numbers from a list into a single number.
Python program to convert words of a list into a single string.
Python program to print elements of the list separately.
Python program to create a sublist of numbers and their squares from 1 to 10.