sum(range(n)) != n(n+1)/2

Published: 29 May 2022
on channel: mCoding
58,627
3.7k

It's not the "n" you're looking for!

I received hundreds of comments in my post popular video that sum(range(n)) is supposed to be n(n+1)/2... except it's not! What's going on then?

― mCoding with James Murphy (https://mcoding.io)

Source code: https://github.com/mCodingLLC/VideosS...
fastest way to loop:    • The Fastest Way to Loop in Python - A...  

SUPPORT ME ⭐
---------------------------------------------------
Patreon:   / mcoding  
Paypal: https://www.paypal.com/donate/?hosted...
Other donations: https://mcoding.io/donate

Top patrons and donors: Jameson, Laura M, Vahnekie, Dragos C, Matt R, Casey G, Johan A, John Martin, Jason F, Mutual Information, Neel R

BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Discord:   / discord  
Github: https://github.com/mCodingLLC/
Reddit:   / mcoding  
Facebook:   / james.mcoding