# The Comprehensive Set

• Comments posted to this topic are about the item The Comprehensive Set

• learned something new, thanks, Steve

____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”

• That's true!

http://doc.pyschools.com/console

• The answer is correct but the explanation is incorrect.

• The explanation is confusing.
print ([x%2 for x in range(10) if x % 2 == 0]) returns 5 values, but all of them are 0 (x % 2).
A set returns distinct values, consequently the result is just one 0.

14090 SW TENNESSEE LN

• gary.rumble - Wednesday, March 20, 2019 9:59 AM

The explanation is confusing.
print ([x%2 for x in range(10) if x % 2 == 0]) returns 5 values, but all of them are 0 (x % 2).
A set returns distinct values, consequently the result is just one 0.

Copy pasted part of the explanation from another question. The explanation is changed to note that x%2 returns 0 for even numbers.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply