• + 1 comment

    Stupid question, but what is the difference between these two?

    current = d.popleft() if d[0] >= d[-1] else d.pop()

    if d[0] >= d[-1]: current = d.popleft() else: d.pop()

    your top one works - mine didn't.