From 399ff13689ab2ddcd94f5ff8845a36176133496d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Mon, 5 Aug 2019 05:58:55 +0200 Subject: [PATCH] List --- README.md | 1 + index.html | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 99efd7f..be0d076 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ list_of_chars = list() ``` ```python + = .count() # Returns number of occurrences. Also works on strings. index = .index() # Returns index of first occurrence or raises ValueError. .insert(index, ) # Inserts item at index and moves the rest to the right. = .pop([index]) # Removes and returns item at index or from the end. diff --git a/index.html b/index.html index a2fda15..8d152a8 100644 --- a/index.html +++ b/index.html @@ -249,7 +249,8 @@ flatter_list = list(itertools.chain.from_iterable(<list>)) product_of_elems = functools.reduce(lambda out, x: out * x, <collection>) list_of_chars = list(<str>) -
index = <list>.index(<el>)     # Returns index of first occurrence or raises ValueError.
+
<int> = <list>.count(<el>)     # Returns number of occurrences. Also works on strings.
+index = <list>.index(<el>)     # Returns index of first occurrence or raises ValueError.
 <list>.insert(index, <el>)     # Inserts item at index and moves the rest to the right.
 <el> = <list>.pop([index])     # Removes and returns item at index or from the end.
 <list>.remove(<el>)            # Removes first occurrence of item or raises ValueError.