Help- can you explain to me this code for Functions: Fundamentals 1/14 screen

I was trying to solve Functions:Fundamentals, 1/14 screen. The instructions are as follows:

  1. Compute the sum of a_list (already defined in the code editor) without using sum().
  • Initialize a variable named sum_manual with a value of 0.
  • Loop through a_list, and for each iteration add the current number to sum_manual.
  1. Print sum_manual and sum(a_list) to see if the values are the same.

The answer to this is:
a_list = [4444, 8897, 6340, 9896, 4835, 4324, 10, 6445,
661, 1246, 1000, 7429, 1376, 8121, 647, 1280,
3993, 4881, 9500, 6701, 1199, 6251, 4432, 37]

sum_manual= 0
for list_element in a_list:
sum_manual += list_element

print(sum_manual)
print(sum(a_list))

Can someone explain to me why do I need to use list_element instead of just element for the loop?

This should help answer your question - The words in For xxx in dataset - #2 by the_doctor

1 Like

thank you so much for helping me on this :slight_smile:

1 Like