Skip to content

Commit a76e387

Browse files
committed
Ensure these are always lists
So that they print nicely, as we show. No, this isn't ideal Python, but I'm trying to be somewhat mechanistic in this modernisation. I'm not going to rewrite this section now.
1 parent 7056221 commit a76e387

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tutorials/python.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ Combined with the `range` function, which returns a list of numbers in a certain
475475

476476
~~~~~ python
477477
my_list = [42, "BOOMERANG!!!", [0, 3]]
478-
print range(len(my_list))
478+
print list(range(len(my_list)))
479479
~~~~~
480480

481481
Output:
@@ -487,9 +487,9 @@ Output:
487487
The `range` function can also take multiple parameters:
488488

489489
~~~~~ python
490-
print range(5) # numbers from 0 to 4.
491-
print range(2, 5) # numbers from 2 to 4.
492-
print range(1, 10, 2) # odd numbers from 1 to 10
490+
print list(range(5)) # numbers from 0 to 4.
491+
print list(range(2, 5)) # numbers from 2 to 4.
492+
print list(range(1, 10, 2)) # odd numbers from 1 to 10
493493
~~~~~
494494

495495
Output:

0 commit comments

Comments
 (0)