I have a legit situation like this where I need to implement a method that changes the incoming object itself (convert list into dict)
def f(l): # f is a function that receives a list as input
pass # Implement this
x = ['Hello', 'World']
f(x)
print(x) # x is now a dict {'hello':'world'}
How will you implement the above f() ?
The key thing is upon calling f() the incoming object itself must be mutated into different type.
Note: Genuine answers welcome instead of questioning the situation.
lto be global within your closurex? I.e.x = f(x)returnit.