❓ Quiz Python

Une liste compréhension avec condition.

PYTHONDebutantlistes
20
quiz.py
1
nombres = [1, 2, 3, 4, 5, 6]
2
pairs = [n for n in nombres if n % 2 == 0]
3
print(len(pairs))