python inline for loop if else