DEV Community

Discussion on: Daily Coding Puzzles - Nov 4th - Nov 9th

Collapse
 
aspittel profile image
Ali Spittel • Edited

Python!

def array_diff(a, b):
    return [l for l in a if l not in b]
Collapse
 
thejessleigh profile image
jess unrein

List comprehensions are truly a gift.

Thread Thread
 
aspittel profile image
Ali Spittel

YES -- they are so elegant.

Collapse
 
dschep profile image
Daniel Schep

Or with sets!

def array_diff(a, b):
    return list(set(a) - set(b))