Librenix  
(Show all Python articles . . .
)  
Headlines | Linux | Apps | Coding | BSD | Admin | News
Information for Linux System Administration 

Python for Kids

Up
vote
Down

A series of Python tutorials for children (or programming newbies) in a blog format. The article linked below implements a stand-alone Python program.
In the last tutorial we created a file using our text editor and saved a function to it. This file was called trivia.py and in it was the module “trivia”. We then started Python in a console and import()ed the trivia module. Once imported, it created a “namespace” and we could access the askQuestion() function from within the trivia namespace by using a dot – trivia.askQuestion(). In order for the module to work properly we had to include an import statement within the module itself so that everything that the module relied upon was imported within the module. We then manually loaded our data from a pickle file we created and, manually, ran the askQuestion() function on the first question in our data store. Finally we added docstrings to the function and the module.

In this tutorial we’re going to try to do much the same thing again, but without using the Python interpreter. That is, we will need to take the things we did in the interpreter and implement them in our trivia.py file. We will have a functioning (although still quite simple) stand alone Python program.
 read more | mail this link | score:9248 | -Ray, May 19, 2011
More Programming articles...

Buy Fine Art on Canvas Online

Selected articles

Space Tyrant: Multithreading lessons learned on SMP hardware

Space Tyrant: A multiplayer network game for Linux

Space Tyrant: A threaded C game project: First Code

Missing the point of the Mac Mini

Hacker Haiku

Why Programmers are not Software Engineers

The short life and hard times of a Linux virus

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

 
Articles are owned by their authors.   © 2000-2012 Ray Yeargin