Write a star drawing program using the Tkinter GUI toolkit that comes with Python, or another GUI toolkit if you want to.


Here is an example of the use of module fileinput ...

# module fileinput allows for line by line processing of files
# fileinput.input(files=None, inplace=False, backup='', bufsize=0, 
#     mode='r', openhook=None)
# notice that the default mode is 'r' for reading text files 
# tested with Python27 and Python32  by vegaseat

import fileinput

# create a text file for testing
text = """\
fname = "aaa1.txt"
fout = open(fname, "w")

# can handle a tuple of files like files=(fname1, fname2, ...)
# the backup file fname.bak is optional
# in this case the original file is saved as "aaa1.txt.bak" 
fin = fileinput.input(files=fname, inplace=True, backup='.bak')

# process each line of the file
for line in fin:
    # print is overloaded to add 'booh!' to each line of file
    # does not actually print on the console screen
    print(line.strip() + " booh!")

# now check the processed file ...
for line in open(fname):
    print("new line --> %s" % line.strip())

'''result ...
new line --> Hello booh!
new line --> World booh!

Investigate what other line by line processing you can do.

Edited by vegaseat: for

Votes + Comments
nice concept

Begin a class repository and write one every so often. They can come in handy more often than you think. Pick a single real world or virtual object and write a class for it.

Votes + Comments
Interesting idea
good idea

Use one of the Python GUI toolkits to create a rainbow effect as a drawing or with rainbow colored text.


We all know the

for x in range(a,b)

function but it has overload issues
try writing an alternative that doesn't have overload issues for example


will overload

Editor's note: This has been fixed in Python3 where range is now an iterator.

Edited by vegaseat: note


Create a search for keywords file search utility. Something you can search all your code samples with. Might just be quite practical.

Edited by Ene Uran: n/a

Votes + Comments
yeah like xfind
something like xfile

Create a little alarm utility that runs in the background and will beep after a set amount of time.


Compare module re (regex) with some of the Python builtin string functions.

For instance:

import re

# wisdom from Mark Twain
text = '''
When your friends begin to flatter you on how young
you look, it's a sure sign you're getting old.

searched = re.search("flat", text)
if searched.group(0):
    print("found '%s'" % searched.group(0)) 
    start, end = searched.span()
    print("at text index start = %d, end = %d" % (start, end))

""" my result is >>
found 'flat'
at text index start = 28, end = 32

Python has a function find() that would work similarly.

What would you do if the text had several sub-strings you were searching for?

Edited by ZZucker: n/a


I guess this might be a little tricky for a beginner, but you could make a 2D motion tracking program. For example you could start with a picture of a black background with a few pink pixels on it. Then use a library such as pygame (see "Surface.get_at" http://www.pygame.org/docs/ref/surface.html) to get the colour of each pixel in the image. This way you can find the pink dots (tracking points). You could advance this to a series of pictures that you could then use to apply to motion to another image.
So take your tracking data from the pink dots and apply the data to draw functions in PyGame to make an animated stickman, for example.


Write a Popularity Quiz using a number of multiple choice questions. You can use Google to see some of those questions and figure out the interpretation of the answers.

Votes + Comments
sounds interesting

Use one of the Python GUI toolkits to display an image of a person. Define hot-spots (regions) on the person so when you click on them it will tell you which part of the body has been clicked on.

Votes + Comments
fine project

Sorry if this has been posted before:

SPOJ especially tutorial problems.

It can a bit challenging, since most problems are demanding algorithmically and SPOJ judges (yes, software ones) are pretty strict on I/O, but it is also pretty much fun.


The game show "Wheel of Fortune" shows a number of empty tiles and gradually (at random) fills in the tiles with the missing letters. The players are given the category and have to guess the word or phrase at the earliest possible moment. This would be a nice game to write in Python and a GUI toolkit like Tkinter.


Write a Python program that generates this type of data string up to a value of 99.
data_str = """\

Your mission is to
write a program to
open any text file
    containing a tree like this one
and output
    a python list
    having the same structure as this tree
    for example
        this is a nested node
        but this one
            is more deeply nested
    You can add an option
        to accept different encodings
        for the file
    et voilĂ !

The output list must be the following

 [u'Your mission is to'],
 [u'write a program to'],
 [u'open any text file', [u'containing a tree like this one']],
 [u'and output',
  [u'a python list'],
  [u'having the same structure as this tree'],
  [u'for example',
   [u'this is a nested node'],
   [u'but this one', [u'is more deeply nested']]],
  [u'You can add an option',
   [u'to accept different encodings'],
   [u'for the file']],
  [u'et voil\xe0!']]]

Now you wrote your first text parser.

Edited by Gribouillis


Most of us remember September 11, 2001.
Write a Python program that shows how many days ago that event was, and on what day of the week.


Is it possible a PC app? for example an inventory system.... or POS (point of sales)?
I am curious about the language right now all I can do is just connecting to MySQL and displaying query results in DOS COMMAND


what about making a simple classical bouncing ball game as indicated in the book entitled "how to think like a computer scientist pyhton 2, chapter 8?

  1. Use the SRCDS python library to make a console or GUI based RCON tool for Source and Half-Life game servers.

  2. Similarly, take an example code snippet (example: HTTP server) and write a GUI frontend for it. Some things to include for the given example: data tickboxes for IP:port which disable when the server is running and perhaps data logging (log start time, end time, any errors in a text file). Final addition: add command line tools to make it fully automated.

Remember though, don't take credit for code that isn't yours if you use it!


What do you expect the results to be?

tuple_list = [(1, 2, 3), (4, 5, 6), (7, 8, 9)]
for first, second, third in tuple_list:

Given the length of three sides, write a function that checks if it is possible to create a triangle.

Edited by ZZucker


You go to the store to buy a pound of Tshibo Java, your favorite coffee beans. There you are confronted with a dilema, the usual pound container costs $10. But the store offers you a choice, a new container with 33% more beans for $10 or the one pound container for a 33% discount.

Write a Python program to figure out which deal is the best, or are they the same?

Votes + Comments
economics 101

Write a program that lists the files that are in one directory but not in another directory.

Edited by HiHe

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.