Reputation: 501
i just found this code in a project i'm working on:
applicant_function = []
for ...:
applicant_function.append(...)
...
applicant_function = list(set(applicant_function))
does anyone have an idea what's the meaning behind this?
Upvotes: 1
Views: 34
Reputation: 1672
The meaning is this:-
applicant_function = [] #initializing an empty list
for ...: #for loop initialization
applicant_function.append(...) #appending elements to list
...
applicant_function = list(set(applicant_function)) #converting applicant_function to a set to remove duplicate elements.
Upvotes: 0
Reputation: 622
A set does not allow duplicates. The purpose is presumably to obtain a list without duplicates (every element appears at most once in the list).
Upvotes: 1