Linux Today: Linux News On Internet Time.

More on LinuxToday

Python4Kids New Tutorial: Side Track � Global and Local Variables

Sep 03, 2011, 11:03 (0 Talkback[s])
(Other stories by brendanscott)

[ 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

Related Stories: