how to print elements of a list baed on a condition in python using comprehension code example Example: list comprehension if [f(x) for x in sequence if condition]