for loop and if condition in one line python