About python .pop() method

Okay, this confusion just happened to me as well. But I’m so new, so I don’t know if something is wrong or not to even question it. The coding example I can barely understand enough to know exactly what it is telling me. It’s like being a beginning level Spanish student and trying to translate a paragraph, but having no idea if the grammar structure is correct or not as I am just trying to translate the words to get a general picture.

My original question is what happens to this returned value (in this case, “3”)? Can it be called or stored somewhere else? Does it disappear (and if so, what is the difference between “.pop” and “.del” which doesn’t return anything? If you can’t do anything with the returned value it seems the same as deleting)? How do you call the returned value (am I using the terminology “call” correctly? omg so many questions)

what 3? I am not seeing the value you are referring to, please use an example. Return is literally what is say, it hands you something back. What you do with this returned/handed back information is up to you.

You call function. You don’t call variables or values. But yes, you can store returned value in variable(s)

you can do something with the returned value, that is what makes .pop() (returns removed value) and del different.

1 Like