View Single Post
  #2 (permalink)  
Old October 17th, 2015, 11:02 AM
Egalth Egalth is offline
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2015
Posts: 3
Thanks: 2
Thanked 2 Times in 2 Posts
Default

Sorry folks, forgot to mention that this has already been addressed in the Errata section. However, the correction in the Errata section only mentions the missing not so the result is even integers, instead of even squares:
Code:
>>> result = []
>>> for n in range(1,11):
...     if not n*n % 2:          # "not" now included.
...         result.append(n)     # n*n still missing.
... 
>>> print(result)
[2, 4, 6, 8, 10]                   # Even integers instead of even squares.

Last edited by Egalth; October 17th, 2015 at 11:13 AM.
Reply With Quote
The Following User Says Thank You to Egalth For This Useful Post:
Yehuda Katz (June 26th, 2017)