how to calculate a sum of indicies in a range (1,N) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

how to calculate a sum of indicies in a range (1,N)

in python

8th Aug 2021, 2:20 PM
Mahdi OBD
3 Answers
+ 3
Easy. Sum of integers from 1-n is given by: S = { n(n+1) } / 2 If you want the loop variation, then you're going to have to do that yourself, or at least show an attempt.
8th Aug 2021, 2:33 PM
BootInk
BootInk - avatar
0
Is this lesson/ project 36 of Python for Beginners? If you need help with your approach, please show your code attempt here.
8th Aug 2021, 3:19 PM
Lisa
Lisa - avatar
0
Jay Matthews The list-typecast isn't needed, I guess.
8th Aug 2021, 4:48 PM
Calvin Thomas
Calvin Thomas - avatar