Help please, trying to understand this Python code


Hello everyone, i’m new at coding with python and i do not understand what the .append() part does?
This exercise is from the learn python “More with For” at code academy.

Write a for-loop that iterates over start_list and .append()s each number squared (x ** 2) to square_list.

Then sort square_list!
start_list = [5, 3, 1, 2, 4]
square_list = []

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

print square_list

I just want to understand what is .append() used for in this code. Thanks in advance!!!


if there is a function or method you do not understand, documentation exists?

append adds items to the end of the list.


thank you so much, I get it now. Thanks for the fast reply!


You might not always get a reply so fast, so learning to find and read documentation is still a skill you should teach yourself


Got it thank you so much again!!!