Schleifen lösen Probleme2 / 4

Zählen: Wie viele sind länger als 14?

fische.py
python
1fische = [12, 30, 8, 21, 15, 18]
2anzahl = 0
3for fisch in fische:
4if fisch > 14:
5anzahl = anzahl + 1
6print(anzahl)
Ausgabe
4

anzahl startet bei 0. Das if in der Schleife entscheidet bei jedem Fisch, ob gezählt wird.

17.1/60