Values of some variables
It's because update functions use the non-updated values of c
and w
. There are probably better ways of doing this but try adding:
global c, w
in each update function definition.
Your outermost scope has the variables c
and w
but the variables c
and w
in the functions are completely different variables as they're neither children of your outerscope nor are the variables explicitly passed into them.