python for loop and if statement in one line