Skip to content

Commit 3c0ce61

Browse files
committed
rearrange description of 'range', making a bullet list and putting the examples inline.
1 parent fc1cf37 commit 3c0ce61

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

_episodes/02-loop.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,19 @@ so we should always use it when we can.
268268
269269
> ## From 1 to N
270270
>
271-
> Python has a built-in function called `range` that creates a sequence of numbers. Range can
272-
> accept 1-3 parameters. If one parameter is input, range creates an array of that length,
273-
> starting at zero and incrementing by 1. If 2 parameters are input, range starts at
274-
> the first and ends just before the second, incrementing by one. If range is passed 3 parameters,
275-
> it starts at the first one, ends just before the second one, and increments by the third one. For
276-
> example,
277-
> `range(3)` produces the numbers 0, 1, 2, while `range(2, 5)` produces 2, 3, 4,
278-
> and `range(3, 10, 3)` produces 3, 6, 9.
271+
> Python has a built-in function called `range` that creates a sequence of numbers. `range` can
272+
> accept 1, 2, or 3 parameters.
273+
>
274+
> * If one parameter is given, `range` creates an array of that length,
275+
> starting at zero and incrementing by 1.
276+
> For example, `range(3)` produces the numbers `0, 1, 2`.
277+
> * If two parameters are given, `range` starts at
278+
> the first and ends just before the second, incrementing by one.
279+
> For example, `range(2, 5)` produces `2, 3, 4`.
280+
> * If `range` is given 3 parameters,
281+
> it starts at the first one, ends just before the second one, and increments by the third one.
282+
> For exmaple `range(3, 10, 2)` produces `3, 5, 7, 9`.
283+
>
279284
> Using `range`,
280285
> write a loop that uses `range` to print the first 3 natural numbers:
281286
>

0 commit comments

Comments
 (0)