python for loop in one line with if else