DAY 18 of PYTHON top 100 questions : from Basic to Advanced !!

Hello, I'm Priya Chakraborty, a dedicated B.Tech student in Electrical Engineering at Siliguri Institute Of Technology. I'm an enthusiastic learner, constantly seeking to expand my skill set and knowledge base. With a solid foundation in programming languages such as C, R, Python, and MySQL, I'm poised to tackle complex technical challenges.
But my passions extend beyond the realm of engineering. I'm also an aspiring content writer, driven by a curiosity to communicate ideas, both technical and non-technical, in a way that captivates and educates.
My journey is defined by a relentless pursuit of self-improvement, coupled with strong communication skills. I believe in the power of continuous learning and the importance of sharing knowledge.
Write a Python program to find the sum of all elements in an array:-
l=[10,10,10,10,10]
sum=0
for i in l :
sum+=i
print(sum)
Output:-
50
It calculates the sum of all the elements in the list l. The variable sum is used to store the cumulative sum as you iterate through the elements of the list.
If you are a beginner and want to know more about Python programming, you can read my Basics of Python blogs (From part 1 to part 15).
HAPPY LEARNING !!!




