2

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

5

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 = """\
Hello
World    
"""
fname = "aaa1.txt"
fout = open(fname, "w")
fout.write(text)
fout.close()

# 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
3

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
2

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

3

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

range(0,999999999)

will overload

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

Edited by vegaseat: note

3

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
0

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

1

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

0

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.

3

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
2

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
1

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.

0

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.

0

Write a Python program that generates this type of data string up to a value of 99.
data_str = """\
10,11,12,13,14,15,16,17,18,19
20,21,22,23,24,25,26,27,28,29
30,31,32,33,34,35,36,37,38,39
40,41,42,43,44,45,46,47,48,49
"""
...

1
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

1

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.

0

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

2

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?

0
  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!

1

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:
    print(second)
0

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

Edited by ZZucker

2

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
2

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.