I'm learning programming with Python, and I need a function where I can send different variables to modify them, but if the variable doesn't exist, it creates one with a defined value.
Lets say I have...:
x = 83
y = 91
... And I need a function that modifies the existing variables, but if I send a variable that is not defined, then it creates it. Say I need that any variable created starts at 60. So I send the Z value to my function, and since it isn't defined, it defines z = 60
.
My problem is I don't even know how to write said function. Is it even possible? Or do i need to have z = 0
as a placeholder, check if it's equal to 0, and then modify it? I don't want to have variables that may not be used occupying space. I'm using Python 3.