for loop with if condition in python one line