Hi, I confused why the output said count is 0. I am confused about line 39. So in line 30, an object with attribute count is created and set to 1 to the variable c. But when it enters function m, wouldn’t c be reassigned? Or is it because the variable c in m is a local variable and doesn’t after the local variable c in the main function? Thanks.


yes, c and n are local variable within the m function. Any changes made to them won’t be reflected anywhere else.

If you want to change the values, you have to return c and n, then re-assign the c and n variable in the main function with the returned result by the m function