You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.html
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -249,7 +249,8 @@
249
249
product_of_elems = functools.reduce(<spanclass="hljs-keyword">lambda</span> out, x: out * x, <collection>)
250
250
list_of_chars = list(<str>)
251
251
</code></pre>
252
-
<pre><codeclass="python language-python hljs">index = <list>.index(<el>) <spanclass="hljs-comment"># Returns index of first occurrence or raises ValueError.</span>
252
+
<pre><codeclass="python language-python hljs"><int> = <list>.count(<el>) <spanclass="hljs-comment"># Returns number of occurrences. Also works on strings.</span>
253
+
index = <list>.index(<el>) <spanclass="hljs-comment"># Returns index of first occurrence or raises ValueError.</span>
253
254
<list>.insert(index, <el>) <spanclass="hljs-comment"># Inserts item at index and moves the rest to the right.</span>
254
255
<el> = <list>.pop([index]) <spanclass="hljs-comment"># Removes and returns item at index or from the end.</span>
255
256
<list>.remove(<el>) <spanclass="hljs-comment"># Removes first occurrence of item or raises ValueError.</span>
0 commit comments