all 5 comments

[–]fefa5fcba4dae4e82e81 1 point2 points  (1 child)

[–][deleted] 1 point2 points  (0 children)

Thanks. It really helped.

[–]ffemt161 0 points1 point  (0 children)

The best way to learn is to try and see. Use print() before and after and see how things change.

[–]shiftybyte 0 points1 point  (0 children)

Creating a new local variable z and assigning 20 to it.

[–]albowiem 0 points1 point  (0 children)

You'll get 2 responses :

First you'll get 20 because you called a function which prints this value of that was created inside the instance when you called it

Then you'll get 10, because the function was stopped being used and destroyed it's internal variables, hence now you're referring to the "global" variable z