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

Buy Digital Art Online

coding headlines

Tutorial: Create an NFS-like Storage Server with GlusterFS on Ubuntu 12.10

Unix: Shell Script Wrapper Examples

Bash: Use the Test Command for multiple aspects

Perl One-Liners Explained: Handy Regular Expressions

e-book: Sed One-Liners Explained

Command line functions

Bash Functions

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

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