NathanDrake - 4 months ago 5x

Python Question

I'm new to python and I need help to re-write that for loop function with indentations below

`y = [g(x,y) for x in xs for y in xs if f(x,y)]`

full code is here

`g = lambda x,y:(x-y)`

f = lambda x,y: x>y

xs = [1,2,3,4]

y = [g(x,y) for x in xs for y in xs if f(x,y)]

Source (Stackoverflow)

Comments