What is the difference between Python’s list methods append and extend?
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
append: Appends object at the end.
x = [1, 2, 3] x.append([4, 5]) print(x)
extend: concatenates the first list with another listx = [1, 2, 3] x.extend([4, 5]) print(x)