On Sat, Feb 15, 2014 at 04:25:34PM +0000, Marc Eymard wrote:

> Can somebody explain why both low_range and high_range are still 
> returning their initial values ?

Because you haven't changed either of them. Imagine the chaos if every 
time you did arithmetic on a variable, Python changed the variable:

x = 1
y = x + 100

What is the value of y? 101, correct?

What is the value of x? It should still be 1, not 101.

The same applies when you get rid of the "y =" and just pass it to a 
function:

x = 1
some_function(x + 100)

What's the value of x? It needs to be 1, because you haven't changed it.

The only way to change x is to explicitly change it:

x = x + 100


-- 
Steven
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to