If there is a list then we need to find the numbers in that list which occurs only once in python.. Pls help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If there is a list then we need to find the numbers in that list which occurs only once in python.. Pls help

14th Sep 2020, 5:53 AM
Ganesh S
2 Answers
+ 2
print([li for li in numbers if numbers.count(li)==1])
14th Sep 2020, 6:00 AM
Oma Falk
Oma Falk - avatar
+ 1
You can use list.count(x)
14th Sep 2020, 5:57 AM
[][]