Python Inline For Loop With If