Skip to content

Instantly share code, notes, and snippets.

@worldmind
Created April 3, 2019 06:55
Show Gist options
  • Save worldmind/f6caf6da5dcc5d7d4bc552b412bbf7aa to your computer and use it in GitHub Desktop.
Save worldmind/f6caf6da5dcc5d7d4bc552b412bbf7aa to your computer and use it in GitHub Desktop.
Loop scope
def main():
y = 0
for k in range(1,3):
z = k
def inside_main():
print(y)
print(z)
print(k)
inside_main()
if __name__ == '__main__':
main()
@worldmind
Copy link
Author

[worldmind@localhost ~]$ python3 test.py 
0
2
2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment