Undefined 'Number'?


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

for number in start_list:
square_list.append(number ** 2)

print square_list

In this code, how is ‘number’ defined?


It is defined in the for statement, and acts as a temporary variable to hold each value in the list, in turn.


Thank you for clarifying!


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