I am trying to check if id is in a list and append the id only if its not in the list using the below code..however I see that the id is getting appended even though id is alre
A more pythonic way, without using set is as follows:
lst = [1, 2, 3, 4] lst.append(3) if 3 not in lst else lst