39. Problem to check the given element exists in the list.

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
  1. Take a list as input.
  2. Use the membership operator i.e. in or not in to check whether an element exists in the list or not.
  3. 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

Replace the last and the first number of the list

Remove all odd index elements

Leave a Comment