I was using a lambda statement to perform math, and happened to repeatedly use one certain value. Therefore I was wondering if it was possible to assign and use
Im no expert at this, but the way i did it was by modifying globals() or locals()
like this:
lambda: globals().__setitem__('some_variable', 'some value')
or if it's inside a function:
lambda: locals().__setitem__('some_variable', 'some value')
you could also use update() instead of __setitem__() if you wanted to, but that's a bit redundant.