In this example, I am trying to have the program change the AB variable's (Global Variable) value within a [while] statement. When I have the program print out the variable's value after the program if finished, it hasn't changed at all, no matter how many times the [while] loop is looped. Is there a way to change this?
You've just made a very small error. It's quite easy to make. On line 9, it should be
ab+=1 is shorthand for
ab+1 just adds
ab, but doesn't store the value.
Please mark this as the answer if it solved your problem :)