Skip to content

Commit fe0f9af

Browse files
committed
case when example
1 parent cfbbd73 commit fe0f9af

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ Given an array `arr`, count the number of items in bins [0, 3), [3, 6), [6, 9) a
5050
>>> arr
5151
UltraFastList([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
5252

53-
>>> result = arr.case(default=4)\
54-
... .when(lambda x: x < 3, then=1)\
55-
... .when(lambda x: x < 6, then=2)\
56-
... .when(lambda x: x < 9, then=3)\
53+
>>> result = arr.case(default='[9, +inf)')\
54+
... .when(lambda x: x < 3, then='[0, 3)')\
55+
... .when(lambda x: x < 6, then='[3, 6)')\
56+
... .when(lambda x: x < 9, then='[6, 9)')\
5757
... .end()\
5858
... .counter()
5959
>>> result
60-
{4: 3, 2: 3, 3: 3, 1: 3}
60+
{'[3, 6)': 3, '[9, +inf)': 3, '[6, 9)': 3, '[0, 3)': 3}
6161
```
6262

6363

0 commit comments

Comments
 (0)