-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Description
On page 40 there's a code listing printing a sequence of odd numbers with the following introduction:
Here is an example of using continue to print a string of even numbers. In this case, the result could be accomplished just as well with an
if-else
statement, but sometimes the continue statement can be a more convenient way to express the idea you have in mind:
In [7]: for n in range(20):
# check if n is even
if n % 2 == 0:
continue
print(n, end=' ')
1 3 5 7 9 11 13 15 17 19
Shouldn't the intro paragraph say odd instead of even?
Thank you for writing this book and publishing it for free! I really enjoy it and recommend it to my colleagues who have to dip their toes in some Python code.
Metadata
Metadata
Assignees
Labels
No labels