Please support our Python advertiser: Programming Forums
![]() |
After you got the basics of Python under your belt, the best way to get a good knowledge of the language and improve your coding skills is to start on a project you are interested in. This sticky is dedicated to a list of just such projects.
If you know a good project, please post it here. If you have questions, start your own thread and don't clutter the sticky.
If you know a good project, please post it here. If you have questions, start your own thread and don't clutter the sticky.
May 'the Google' be with you!
Start a code library. As time goes on you will collect code snippets, hints and tricks from all over the net. So why not use Python to store these cut and pasted pieces of code in a file.
Attach a title and a set of keywords to each snippet that allows you to search the file and retrieve the code easily. You might want to use just one file and keep appending, so you have to find a way to keep the snippets appart from each other within the file. I have done it with a list where the items were separated by a dotcode-marker, works well, but it may not be a good way.
You can search the file directly or load the file into a list to speed things up. I leave it up to you. Keep thinking!
Attach a title and a set of keywords to each snippet that allows you to search the file and retrieve the code easily. You might want to use just one file and keep appending, so you have to find a way to keep the snippets appart from each other within the file. I have done it with a list where the items were separated by a dotcode-marker, works well, but it may not be a good way.
You can search the file directly or load the file into a list to speed things up. I leave it up to you. Keep thinking!
May 'the Google' be with you!
A units of measurement converter. Think about all the things that are measured, like distance, area, volume, energy, weight, temperature, pressure and so on. Now think about the many units of measurement the people around the globe use, anything from rods, stones, pounds, inches, pints and liters. A rather long list.
Start simple, let's say just the distances and a few units. Get that to work, then add more. Google the net for conversion factors. How would you handle the information? Maybe a dictionary in Python. Are there any neat shortcuts?
Your program should answer questions like:
"How many inches in a meter?"
"How many milliliters in a pint?"
"How many acres in a square-mile?"
"How many pounds in a metric ton?"
"How many calories in a BTU?"
Start simple, let's say just the distances and a few units. Get that to work, then add more. Google the net for conversion factors. How would you handle the information? Maybe a dictionary in Python. Are there any neat shortcuts?
Your program should answer questions like:
"How many inches in a meter?"
"How many milliliters in a pint?"
"How many acres in a square-mile?"
"How many pounds in a metric ton?"
"How many calories in a BTU?"
May 'the Google' be with you!
Construct a sentence generator. Write down a bunch of sentences. Now pick them apart into lists of nouns, verbs, adverbs, adjectives and so forth. Use these pieces and create new sentences more or less at random. Some of those will be silly, some utter nonsense, but some could be the start of poetry or a novel.
Just to get you started, here is a very simple sentence generator, that takes the three parts (subject, action, object) of a standard sentence, shuffles these parts and reassembles the sentence ...
Click on "Toggle Plain Text" so you can highlight and copy the code to your editor without the line numbers.
Just to get you started, here is a very simple sentence generator, that takes the three parts (subject, action, object) of a standard sentence, shuffles these parts and reassembles the sentence ...
python Syntax (Toggle Plain Text)
# goofy sentence generator import random def make_sentence(part1, part2, part3, n=1): """return n random sentences""" # convert to lists p1 = part1.split('\n') p2 = part2.split('\n') p3 = part3.split('\n') # shuffle the lists random.shuffle(p1) random.shuffle(p2) random.shuffle(p3) # concatinate the sentences sentence = [] for k in range(n): try: s = p1[k] + ' ' + p2[k] + ' ' + p3[k] s = s.capitalize() + '.' sentence.append(s) except IndexError: break return sentence # break a typical sentence into 3 parts # first part of a sentence (subject) part1 = """\ a drunken sailor a giggling goose the yearning youth the obese ostrich this mean mouse the skinny sister""" # middle part of a sentence (action) part2 = """\ jumps over flies over runs across openly ogles twice tastes vomits on""" # ending part of a sentence (object) part3 = """\ a rusty fence the laughing cow the weedcovered backyard the timid trucker the rancid old cheese the jolly jelly""" print '-'*60 sentence = make_sentence(part1, part2, part3, 3) for item in sentence: print item print '-'*60 """ a typical result --> A drunken sailor flies over the laughing cow. The obese ostrich runs across the weedcovered backyard. This mean mouse openly ogles the jolly jelly. """
Last edited by vegaseat : Mar 1st, 2007 at 4:17 pm. Reason: missing lines
May 'the Google' be with you!
Why not a story teller? This is for the people that like writing stories. Ask the reader for a preference and the story starts in that direction. After a while ask for another preference and branch off along that preference.
The story evolves as directed by the reader. Great for adventure, mystery, romance and detective stories. Try it out on a short and simple story first. Who knows, it could be the next bestseller.
The story evolves as directed by the reader. Great for adventure, mystery, romance and detective stories. Try it out on a short and simple story first. Who knows, it could be the next bestseller.
May 'the Google' be with you!
Computer art can be fun. PyGame might be the way to go here. Start out by drawing geometric designs using circles, ovals, lines, rectangles, lots of colors, put them in a loop that changes location, dimensions and colors.
To get an idea, look at the Python snippet at:
http://www.daniweb.com/code/snippet384.html
You need to be able to freeze the graphics and save it as an image file.
To get an idea, look at the Python snippet at:
http://www.daniweb.com/code/snippet384.html
You need to be able to freeze the graphics and save it as an image file.
May 'the Google' be with you!
Make a physics problem solver. Sometimes called an equation solver.
Let's say you have a simple kinematics question:
Bertha jogs at an average 7 miles/hour, and her typical path is 2.5 miles long. How long will it take her.
You would let the user enter three items:
1. 7 miles/hour
2. 2.5 miles
3. ? hours
Your program should figure out the formula and fill the question mark.
A more advanced version would convert units and standardize them. So the user can enter:
1. 7 miles/hour
2. 17 minutes
3. ? feet
Once you get the hang of it, you can go from simple kinematics to dynamics, force, work, gravitation, magnetic flux, thermodynamics, quantum mechanics or to relativity.
Back in the dark ages when I took physics, I wrote one of these in a then brand-new language called C.
Let's say you have a simple kinematics question:
Bertha jogs at an average 7 miles/hour, and her typical path is 2.5 miles long. How long will it take her.
You would let the user enter three items:
1. 7 miles/hour
2. 2.5 miles
3. ? hours
Your program should figure out the formula and fill the question mark.
A more advanced version would convert units and standardize them. So the user can enter:
1. 7 miles/hour
2. 17 minutes
3. ? feet
Once you get the hang of it, you can go from simple kinematics to dynamics, force, work, gravitation, magnetic flux, thermodynamics, quantum mechanics or to relativity.
Back in the dark ages when I took physics, I wrote one of these in a then brand-new language called C.
May 'the Google' be with you!
Translate from one language to another. For instance from English to Texan.
Hint, one approach would be the one used in the Python code snippet at:
http://www.daniweb.com/code/snippet395.html
Hint, one approach would be the one used in the Python code snippet at:
http://www.daniweb.com/code/snippet395.html
Last edited by vegaseat : Sep 15th, 2006 at 1:07 am.
May 'the Google' be with you!
![]() |
Similar Threads
Other Threads in the Python Forum
- Ideal project for a beginner? (Python)
- Hep finding C++ Projects (Python)
- Help finding C++ Projects (C++)
- New task from Projects for the beginner: (Python)
Other Threads in the Python Forum
- Previous Thread: pycurl cookies
- Next Thread: tkinter button widget - passing parameter to function
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode