Last active
June 15, 2020 12:22
-
-
Save rtacconi/fb45ac8be417ac0e665de8df08cb713b to your computer and use it in GitHub Desktop.
In each input list, every number repeats at least once, except for two. Write a function that returns the two unique numbers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def retun_unique(lst): | |
return [i for i in lst if lst.count(i) <= 1] | |
return_unique([1, 9, 8, 8, 7, 6, 1, 6]) # -> [9, 7] | |
return_unique([5, 5, 2, 4, 4, 4, 9, 9, 9, 1]) # -> [2, 1] | |
return_unique([9, 5, 6, 8, 7, 7, 1, 1, 1, 1, 1, 9, 8]) # -> [5, 6] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment