In a coursera python course video the following code was presented:

a = [4,5,6]

def mutate_part(x):
    a[1] = x

mutate_part(200)

The presenter said something like "a is a global variable, so a becomes

[4,200,6] after running mutate_part(200)."

Indeed it does, but why does this work without specifying a as global
within mutate()?
My thinking was that an "undefined" error should have been raised.

Help me understand.  Thanks,

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

Reply via email to