@PythonPr a = [1, 2, 3] # a = [1, 2, 3] b = a.pop() # pop() removes and returns the LAST element # b = 3, a = [1, 2] c = a.pop() # another pop() removes and returns the new LAST element # c = 2, a = [1] print(b + c) # 3 + 2 = 5
@PythonPr But the real answer is knowing why: pop() takes the last item, pop(0) would take the first. 😉 To pop or not to pop — that is the question. 😭🤪🧐