I'm currently learning about the pop() function in Python and have a question.
>>> a = [1,2,3,4]
>>> a.pop(3) #or a.pop()
4
>>> print(a)
[1,2,3]
I get that the pop() function removes and returns the value of the element corresponding to the index. However, the following example is the reason why I'm confused:
>>> a = [1,2,3,4]
>>> def solution(array):
array.pop()
return array
>>> solution(a)
[1,2,3]
First, I get that the function that I've described returns [1,2,3]. However, why does it not return the pop() value? Shouldn't it return 4 since the pop() function inside the solution() has a pop() function which, in definition, returns the value of the popped element?? I thought this pop() function kind of acts like del and print function simultaneously.