Why do you think it should be -1? Where do you think it gets set to -1.
What I'd suggest is drawing up a little table like this:
Step through the code by hand, writing down the values of x and y when they change, and the output at each print statement. Try that, and if you still don't see why that's the output let us know.
Please don't just hand over the answers. We want to encourage the OP to solve his own problem, with a nudge in the right direction here or there as needed. Thanks!
Please don't just hand over the answers. We want to encourage the OP to solve his own problem, with a nudge in the right direction here or there as needed. Thanks!
No problemo I'm newbie here, and this is good advice for me to be good forum user in the future. Thanks.