Dear experts

in learning the principles of Python I came across scope in the
control structure's section.
There I read the notion that variables createted inside a 
control structute can't be seen or accessed from outside that
structure, Python would raise a Name Error.

However in for loops  - also control structures - like in this
simple example:

for i in range(1,11):
    sum = 0
    sum += i

the print function "returns" the last number of range as 
value of the variable sum created inside this for loop.
It should have raised a Name Error instead.
Could somebody please explain this discrepancy?

Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.

Tutor maillist  -
To unsubscribe or change subscription options:

Reply via email to