Python Tuple count() Methode
Beispiel
Gibt zurück, wie oft der Wert 5 im Tupel vorkommt:
thistuple = (1, 3, 7, 8, 7, 5, 4, 6, 8, 5)
x = thistuple.count(5)
print(x)
Definition und Verwendung
Die count()
Methode gibt zurück, wie oft ein bestimmter Wert im Tupel vorkommt.
Syntax
tuple.count(value)
Parameterwerte
Parameter | Description |
---|---|
value | Required. The item to search for |