There's
a special Python method which can extend
a variable's scope in a way which includes the functions' bodies even
if we want not only to read the values, but also to modify them.
This effect is caused by a keyword named "global".
Using
this keyword inside a function with the name or names separated with commas of a variable(s), forces Python to refrain from creating a new variable inside
the function - the one accessible from outside will be used instead.
Look at the example given below.
No comments:
Post a Comment