loading...

re: Daily Coding Puzzles - Nov 4th - Nov 9th VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Wednesday Array.diff (6 KYU): Your goal in this kata is to implement a difference function, which subtracts one list from another and returns th...
 

Python!

def array_diff(a, b):
    return [l for l in a if l not in b]
 

List comprehensions are truly a gift.

YES -- they are so elegant.

 

Or with sets!

def array_diff(a, b):
    return list(set(a) - set(b))
Code of Conduct Report abuse