mCodingLLC / VideosSampleCode

Code from the mCoding sample videos
MIT License
978 stars 203 forks source link

Correct sum_math #13

Closed captainredbleach closed 2 years ago

captainredbleach commented 2 years ago

Fixes a small error in sum_math. Instead of a minus, it should be a plus to give the correct answer

mCodingLLC commented 2 years ago

The formula is correct as stated. Note that range(n) contains the numbers 0 to n-1, not 1 to n. You can verify the answer by checking the output of sum(range(n)) for small values of n, or by plugging in n-1 into the formula you provided.