WOULD YOU SAY PYTHON RETURN FUCTION IS SIMILOAR TO THE POP() FUNCTION ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

WOULD YOU SAY PYTHON RETURN FUCTION IS SIMILOAR TO THE POP() FUNCTION ?

Pop function and Return function would you say they have similarities. They both can return a value and you can store the value in a variable? Keyword: SIMILARTIES ! both can return a value only difference pop() can remove the value!! Python community do you agree with me??

12th Oct 2022, 5:13 AM
ORAL NAPIER
ORAL NAPIER - avatar
4 Answers
+ 6
Oral Napier , first of all, return is not a function. it is a python keyword that can be used to give back (return) values to the caller. return can only be used from inside named functions. this can be a user defined function or a python builtin function or a function from libraries (modules). however, a function does not necessarily have to return anything. the list method pop() can be used to remove a desired element from a list, and uses return to provide the removed element to the user. from this explanations you can see that *return* is NOT similar to the *pop()* method.
12th Oct 2022, 6:04 PM
Lothar
Lothar - avatar
+ 1
Ok thank you I understand now
13th Oct 2022, 5:31 AM
ORAL NAPIER
ORAL NAPIER - avatar
0
No, Pop Remove an Item and Return It. Return function only returns the value
12th Oct 2022, 6:36 AM
Azhagesanヾ(✿)
Azhagesanヾ(✿) - avatar
0
I know pop remove and item but pop has a similarly to return function where it can return the value so it has it difference of removing it and also return it.
12th Oct 2022, 11:39 AM
ORAL NAPIER
ORAL NAPIER - avatar