๐Ÿ“– Beginning Python Programming /
Module: List & Collection

List comprehension

๐Ÿ“– Beginning Python Programming / List & Collection / List comprehension

List comprehension with if condition

scores = [34, 65, 45, 67, 78, 56, 80]
passed_scores = [x for x in scores if x >= 60]
print(passed_scores)

# Result:
# [65, 67, 78, 80]