Jan-06-2021, 09:54 PM
Not sure if this is what you want
https://docs.python-guide.org/writing/go...-arguments
spam = [] def update(my_list, value): my_list.append(value) print(spam) update(spam, 44) print(spam)Note that this will work only because
spam
is a list, i.e. mutable object. Basically your function would returndef double(value): return value * 2 eggs = 2 print(eggs) eggs = double(eggs) print(eggs)also, there is another problem - never use mutable default arguments like in
def Update(A=[]):
https://docs.python-guide.org/writing/go...-arguments
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs