Q.No.1 - Write a Programme to check if an element exists in the list or not. If that element does not exist then add that particular element in the List.

Sol.-

n=input("Enter Your Element")
li=["hello",]
if(n in li):
    print("Your element is already present in li")
else:
    li.append(n)
    print("Your element is not present in li. But now its added to list.")
    print(li)



Explain : Step 1: User enter the element. Step 2: If condition start and check condition that the data is in list (li) present of not. Step 3: If the element not present, else condtion use and li.append(n)- it add element in list. After the it print the statement.

OUTPUT: