Python program to check that a list have elements in it or not .

 Python program to check that a list have elements in it or not.


Code - 

--------------------------------

# Python program to check that a list have elements in it or not .

list2 = ["anant", "shiv", "hariom", "utsav", "shorya", "ajay", "carry", "harry"]


def element_absence_checker(list):
a = input("Enter the name of element which you want to check:- ")
for i in list:
if i == a:
print("Element present in list..")
break
else:
print("Element doesn't present in list.")


element_absence_checker(list2)

Comments

Popular posts from this blog

Single Inheritance, multiple inheritance and multilevel inheritance in python.

Git Commands.

Using class objects, Instance variables, and class variables, class methods and static method in python