MHN
Add a comment on Hacker News →
1 of 357 comments
  1.     len(list(filter(lambda line: all([abs(x) >= 1 and abs(x) <= 3 for x in line]) and (all([x > 0 for x in line]) or all([x < 0 for x in line])), diffs)))
    
    
    Well, point taken about the ordering, but there are many more legible ways to have written that code. Not everything has to be a one liner.

    even:

        def f(diffs):
            cond = lambda line: all([1 <= abs(x) <= 3 for x in line]) and (
                all([x > 0 for x in line]) or all([x < 0 for x in line])
            )
            items = filter(cond, diffs)
            return len(list(items))