User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 374,019 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,700 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser:
Views: 51092 | Replies: 155
Reply
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,333
Reputation: vegaseat is on a distinguished road 
Rep Power: 8
Solved Threads: 170
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Projects for the Beginner

  #1  
Sep 9th, 2005
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.
May 'the Google' be with you!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,333
Reputation: vegaseat is on a distinguished road 
Rep Power: 8
Solved Threads: 170
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Solution Re: Projects for the Beginner

  #2  
Sep 9th, 2005
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!
May 'the Google' be with you!
Reply With Quote  
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,333
Reputation: vegaseat is on a distinguished road 
Rep Power: 8
Solved Threads: 170
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Solution Re: Projects for the Beginner

  #3  
Sep 9th, 2005
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?"
May 'the Google' be with you!
Reply With Quote  
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,333
Reputation: vegaseat is on a distinguished road 
Rep Power: 8
Solved Threads: 170
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Solution Re: Projects for the Beginner

  #4  
Sep 9th, 2005
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 ...
  1. # goofy sentence generator
  2.  
  3. import random
  4.  
  5. def make_sentence(part1, part2, part3, n=1):
  6. """return n random sentences"""
  7. # convert to lists
  8. p1 = part1.split('\n')
  9. p2 = part2.split('\n')
  10. p3 = part3.split('\n')
  11. # shuffle the lists
  12. random.shuffle(p1)
  13. random.shuffle(p2)
  14. random.shuffle(p3)
  15. # concatinate the sentences
  16. sentence = []
  17. for k in range(n):
  18. try:
  19. s = p1[k] + ' ' + p2[k] + ' ' + p3[k]
  20. s = s.capitalize() + '.'
  21. sentence.append(s)
  22. except IndexError:
  23. break
  24. return sentence
  25.  
  26. # break a typical sentence into 3 parts
  27. # first part of a sentence (subject)
  28. part1 = """\
  29. a drunken sailor
  30. a giggling goose
  31. the yearning youth
  32. the obese ostrich
  33. this mean mouse
  34. the skinny sister"""
  35.  
  36. # middle part of a sentence (action)
  37. part2 = """\
  38. jumps over
  39. flies over
  40. runs across
  41. openly ogles
  42. twice tastes
  43. vomits on"""
  44.  
  45. # ending part of a sentence (object)
  46. part3 = """\
  47. a rusty fence
  48. the laughing cow
  49. the weedcovered backyard
  50. the timid trucker
  51. the rancid old cheese
  52. the jolly jelly"""
  53.  
  54. print '-'*60
  55.  
  56. sentence = make_sentence(part1, part2, part3, 3)
  57. for item in sentence:
  58. print item
  59. print '-'*60
  60.  
  61. """
  62. a typical result -->
  63. A drunken sailor flies over the laughing cow.
  64. The obese ostrich runs across the weedcovered backyard.
  65. This mean mouse openly ogles the jolly jelly.
  66. """
Click on "Toggle Plain Text" so you can highlight and copy the code to your editor without the line numbers.
Last edited by vegaseat : Mar 1st, 2007 at 3:17 pm. Reason: missing lines
May 'the Google' be with you!
Reply With Quote  
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,333
Reputation: vegaseat is on a distinguished road 
Rep Power: 8
Solved Threads: 170
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Solution Re: Projects for the Beginner

  #5  
Sep 9th, 2005
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.
May 'the Google' be with you!
Reply With Quote  
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,333
Reputation: vegaseat is on a distinguished road 
Rep Power: 8
Solved Threads: 170
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Solution Re: Projects for the Beginner

  #6  
Sep 9th, 2005
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.
May 'the Google' be with you!
Reply With Quote  
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,333
Reputation: vegaseat is on a distinguished road 
Rep Power: 8
Solved Threads: 170
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Solution Re: Projects for the Beginner

  #7  
Sep 9th, 2005
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.
May 'the Google' be with you!
Reply With Quote  
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,333
Reputation: vegaseat is on a distinguished road 
Rep Power: 8
Solved Threads: 170
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Solution Re: Projects for the Beginner

  #8  
Sep 13th, 2005
How would you write a simple spell checker for a text file?

Start simple and test your code. Attached is full English spelling dictionary file, one word on a line.
Attached Files
File Type: zip DictionaryE.zip (286.9 KB, 176 views)
May 'the Google' be with you!
Reply With Quote  
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,333
Reputation: vegaseat is on a distinguished road 
Rep Power: 8
Solved Threads: 170
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Solution Re: Projects for the Beginner

  #9  
Sep 13th, 2005
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
Last edited by vegaseat : Sep 15th, 2006 at 12:07 am.
May 'the Google' be with you!
Reply With Quote  
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,333
Reputation: vegaseat is on a distinguished road 
Rep Power: 8
Solved Threads: 170
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Solution Re: Projects for the Beginner

  #10  
Sep 13th, 2005
You just wrote a loop allowing the input of 20 names into a list. Alas, you made an error as you entered name number 17. Redesign your input loop, so you can correct the error easily without having to retype the previous 16 names.
May 'the Google' be with you!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 2 (1 members and 1 guests)

djwl2

DaniWeb Python Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Python Forum

All times are GMT -4. The time now is 11:08 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC