Q. Write a function to insert an element in a sorted list only if it does not already exist in the list.
Answer =
lst = [] def inst( x ) : lst.sort() if x in lst : print ("Value Already exist") else : lst.append(x)
Answer =
lst = [] def inst( x ) : lst.sort() if x in lst : print ("Value Already exist") else : lst.append(x)
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )