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!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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
[][]