Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite0
Python inheritance
For the odds method,how to remove the items from the list that’s not odds and return the original list only has the odd numbers?
2 Réponses
+ 4
list(filter(lambda x: x%2==1, numlist))
0
another method with generator
list(p for p in numlist if p%2)