Consider I have a list, n_list
n_list = [2, 4, 4, 5, 2]
My goal is get the unique val that has frequency of occurrence is only 1 in the list.
I am able to do as follows:
result = [val for val in n_list if n_list.count(val) == 1]
for i in result:
print(i)
However, I would like to get the result of list comprehension with the list and just the value. Basically, without writing a separate for loop for it, that means, without:
for i in result:
print(i)
but using list comprehension.