Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

yea, because 5 is the end of the range.

if you do sum(range(0,10,2)), 10 isn't reached either.

why are we having this discussion?



Yeah, but if you write "end_range" I'd expect that to be the end range. So your implementation should actually be something like:

[j2 for j in range(0, (11+1)/2)]

Your code is wrong.

sum(range(0,11,2)) works as expected, [j*2 for j in range(0, (11)/2)] does not.


congrats.


What?

You seem like you have issues.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: