---

Python4Kids New Tutorial: Side Track � Global and Local Variables

[ Thanks to Brendan Scott for this
link. ]

“In the previous tutorial, I used a strange and cumbersome
approach to storing the data that I needed to keep track of the
image files in the directory, the total number of images and what
image we were up to. Instead of just saving the current image
number in a variable called currentImage I instead created a
dictionary called indexes and a key called currentImage, then
assigned the value to that key. I did the same thing for
totalImages as well. You might, justifiably, be thinking –
why didn’t we just use two variables called currentImage and
totalImages? This tutorial is going to try to explain that.”


Complete Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis