From 406539f77bc00ccb7871f3a96d8ee3114819cbd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Mon, 18 Jul 2022 07:06:58 +0200 Subject: [PATCH] Range --- README.md | 21 ++++++++++----------- index.html | 22 +++++++++++----------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index cf3c0f5..072e9ed 100644 --- a/README.md +++ b/README.md @@ -144,9 +144,9 @@ Tuple ----- **Tuple is an immutable and hashable list.** ```python - = () # Empty tuple. - = (,) # Or: , - = (, [, ...]) # Or: , [, ...] + = () # Empty tuple. + = (,) # Or: , + = (, [, ...]) # Or: , [, ...] ``` ### Named Tuple @@ -168,17 +168,16 @@ Point(x=1, y=2) Range ----- -**An immutable and hashable sequence of evenly spaced integers.** - +**Immutable and hashable sequence of integers.** ```python - = range(to_exclusive) # `list(range(3)) == [0, 1, 2]` - = range(from_inclusive, to_exclusive) # `list(range(1, 4)) == [1, 2, 3]` - = range(from_inclusive, to_exclusive, ±step) # `list(range(3, 0, -1)) == [3, 2, 1]` + = range(stop) # range(to_exclusive) + = range(start, stop) # range(from_inclusive, to_exclusive) + = range(start, stop, ±step) # range(from_inclusive, to_exclusive, ±step_size) ``` ```python -from_inclusive = .start -to_exclusive = .stop +>>> [i for i in range(3)] +[0, 1, 2] ``` @@ -217,7 +216,7 @@ from itertools import count, repeat, cycle, chain, islice ```python = islice(, to_exclusive) # Only returns first 'to_exclusive' elements. - = islice(, from_inclusive, …) # `to_exclusive, +step`. + = islice(, from_inclusive, …) # `to_exclusive, +step_size`. ``` diff --git a/index.html b/index.html index 87fe19e..dd30471 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,7 @@
- +
@@ -182,9 +182,9 @@ Counter({'blue': 3 -

#Tuple

Tuple is an immutable and hashable list.

<tuple> = ()                        # Empty tuple.
-<tuple> = (<el>,)                   # Or: <el>,
-<tuple> = (<el_1>, <el_2> [, ...])  # Or: <el_1>, <el_2> [, ...]
+

#Tuple

Tuple is an immutable and hashable list.

<tuple> = ()                                # Empty tuple.
+<tuple> = (<el>,)                           # Or: <el>,
+<tuple> = (<el_1>, <el_2> [, ...])          # Or: <el_1>, <el_2> [, ...]
 
@@ -201,14 +201,14 @@ Point(x=1, y=2
-

#Range

An immutable and hashable sequence of evenly spaced integers.

<range> = range(to_exclusive)                         # `list(range(3))        == [0, 1, 2]`
-<range> = range(from_inclusive, to_exclusive)         # `list(range(1, 4))     == [1, 2, 3]`
-<range> = range(from_inclusive, to_exclusive, ±step)  # `list(range(3, 0, -1)) == [3, 2, 1]`
+

#Range

Immutable and hashable sequence of integers.

<range> = range(stop)                       # range(to_exclusive)
+<range> = range(start, stop)                # range(from_inclusive, to_exclusive)
+<range> = range(start, stop, ±step)         # range(from_inclusive, to_exclusive, ±step_size)
 
-
from_inclusive = <range>.start
-to_exclusive   = <range>.stop
+
>>> [i for i in range(3)]
+[0, 1, 2]
 

#Enumerate

for i, el in enumerate(<collection> [, i_start]):
     ...
@@ -231,7 +231,7 @@ to_exclusive   = <range>.stop
 <iter> = chain.from_iterable(<coll>)        # Empties collections inside a collection in order.
 
<iter> = islice(<coll>, to_exclusive)       # Only returns first 'to_exclusive' elements.
-<iter> = islice(<coll>, from_inclusive, …)  # `to_exclusive, +step`.
+<iter> = islice(<coll>, from_inclusive, …)  # `to_exclusive, +step_size`.
 

#Generator

  • Any function that contains a yield statement returns a generator.
  • @@ -2900,7 +2900,7 @@ $ pyinstaller script.py --add-data '<path>:.'