Hi everybody! I don't know if this is possible to do, but here goes:
Hi have a program where I have several lists. Let's call them l1, l2, l3, l4.
Often in the code, I need to delete a certain item from 2 of the lists I have.
I thought about defining a function that only needs to know which lists I want to modify and what item to delete from them.
def myfunction(myl1's_globalname,myl2's_globalname, itemtodelete):
global myl1's_globalname
The problem is that if I use things like "global myl1's_globalname" when defining the function, I'll have an error saying that global and local variables have the same name.
Isn't there a way to do this such that in the function arguments I write the name of the lists I want to modify and the function makes "global (variable whose name corresponds to 1st argument in the function)"?
thanks in advance!
joana