let's say i have a list
li = [{'q':'apple','code':'2B'},
{'q':'orange','code':'2A'},
{'q':'plum','code':'2A'}]
What is the most efficient way to return the number of unique βcodesβ in this list? In this case, the unique codes are 2, since only 2B and 2A are unique.
I could put everything on a list and compare, but is it really effective?
source
share