"For One and All", "More with For" Re: "Number Variable



This may be a dumb question, because I'm VERY new at this, but I'm a little confused as to where the variable "number" is coming from. It is used in both the "For One and All" and "More with For" exercises. Obviously, the list contains numbers, but I don't really understand where this variable is defined.

start_list = [5, 3, 1, 2, 4]
square_list = []

# Your code here!
for number in start_list:
    square_list.append(number ** 2)
print square_list


It is defined in the loop statement as the block variable that temporarily holds the value at one point at a time in the list being iterated.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.