Skip to content
Advertisement

how to find multiple non-repeating numbers in python?

I have a below method that finds the non-repeating elements in a list:

JavaScript

The code runs successfully and below is the output:

JavaScript

But when I am trying to add more than one non-repeating elements in the list, the output doesn’t change. For example, if I add 11 at the end of the list the output still remains the same as above..

Any idea?

Advertisement

Answer

Actually when you return at the 10th line, the function ends. This is in case you don’t understand the list comprehension yet, as many have given you the solution with that technique. I will just give you a simple solution where it will return a list of non-repeating numbers.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement