Junior — Middle
What value does the append method return in Python?
sobes.tech AI
Answer from AI
In Python, the append method for lists does not return any value, meaning it returns None. It modifies the original list by adding an element to the end, but does not create or return a new list.
Example:
my_list = [1, 2, 3]
result = my_list.append(4)
print(my_list) # Outputs: [1, 2, 3, 4]
print(result) # Outputs: None