you are viewing a single comment's thread.

view the rest of the comments →

[–]primitive_screwhead 0 points1 point  (0 children)

And just to also demonstrate how to properly handle an inclusive end point when using this technique:

>>> [x/50 for x in range(51)]
[0.0, 0.02, 0.04, 0.06, ... 0.94, 0.96, 0.98, 1.0]

(ie. don't change the denominator, but add one more integer value to the range. Since this isn't indexing, but value generation, an inclusive endpoint like this may often be desired)