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:8654 | -Ray, May 19, 2011
More Programming articles...

Abstract Art Prints for Sale

Selected articles

VPS: Xen vs. OpenVZ

Space Tyrant: A multiplayer network game for Linux

Scripting: A parallel Linux backup script

Hacker Haiku

Closed Source Linux Distribution Launched

Download: Linux 3D Client for Starship Traders

The life cycle of a programmer

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

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