Projects for the Beginner

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2005
Posts: 1,221
Reputation: bumsfeld will become famous soon enough bumsfeld will become famous soon enough 
Solved Threads: 138
bumsfeld's Avatar
bumsfeld bumsfeld is offline Offline
Nearly a Posting Virtuoso

Re: Projects for the Beginner

 
0
  #51
May 31st, 2006
Make financial calculator that would show you monthly payments on a loan, or how long you would take to pay off your debts with certain monthly payments, or how many years it would take for your savings to double.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,141
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 947
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Projects for the Beginner

 
0
  #52
Jun 9th, 2006
There are quite a number of songs out there with fairly repetitive lyrics. The "99 bottles of beer on the wall" song is an example, or this cute little example of a lyrics writer for the "old McDonald had a farm" song:
  1. # print the lyrics of the song "Old McDonald had a farm"
  2. # using functions to reduce your work
  3.  
  4. def print_exclamation():
  5. print 'Ee ai ee ai oh!'
  6.  
  7. def print_refrain():
  8. print 'Old McDonald had a farm.'
  9. print_exclamation()
  10.  
  11. def print_song(animal, sound):
  12. print_refrain()
  13. print 'And on his farm he had a ' + animal + '.'
  14. print_exclamation()
  15. print 'With a ' + 2 * (sound + ' ') + 'here,'
  16. print 'And a ' + 2 * (sound + ' ') + 'there.'
  17. print 'Here a ' + sound + ', there a ' + sound + '.'
  18. print 'Everywhere a ' + sound + ' ' + sound + '.'
  19. print_refrain()
  20.  
  21. print_song('cow', 'moo') # test it with the cow that sounds moo
Sit down with the kids and see what other songs you could pythonize!
Last edited by vegaseat; Mar 1st, 2007 at 4:21 pm. Reason: [code=python] tag
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,141
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 947
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Projects for the Beginner

 
0
  #53
Jun 11th, 2006
Here is an interesting project, the name game song ...
The name game!
Shirley!
Shirley Shirley Bo Birley
Banana Fanna Fo Firley
Fe Fi Mo Mirley
Shirley

Lincoln!
Lincoln Lincoln Bo Bincoln
Banana Fanna Fo Fincoln
Fe Fi Mo Mincoln
Lincoln

Come on everybody
I say now let's play a game
I betcha I could make a rhyme
Out of anybody's name

The first letter of the name
I treat it like it wasn't there
But a B or an F
Or an M will appear

And then I say Bo, add a B
Then I say the name
Then Banana Fanna and a Fo
Then I say the name again with an F very plain
Then a Fe Fi and a Mo
Then I say the name again with an M this time
And there isn't any name that I can't rhyme

Arnold!
Arnold Arnold Bo Barnold
Banana Fanna Fo Farnold
Fe Fi Mo Marnold
Arnold

But if the first two letters are ever the same,
Drop them both then say the name
Like Bob Bob drop the B's Bo Ob
Or Fred Fred drop the F's Fo Red
Or Mary Mary drop the M's Mo Ary
That's the only rule that is contrary

Okay?
Now say Bo (Bo!)
Now Tony with a B (Bony!)
Then Banana Fanna and Fo (Banana Fanna Fo!)
Then you say the name again with an F very plain (Fony!)
Then a Fe Fi and a Mo (Fe Fi Mo)
Then you say the name again with an M this time (Mony!)
And there isn't any name that you can't rhyme

Everybody do Tony
Tony Tony Bo Bony
Banana Fanna Fo Fony
Fe Fi Mo Mony
Tony

Pretty good. Let's do Billy
Billy Billy Bo Illy
Banana Fanna Fo Filly
Fe Fi Mo Milly
Billy

Very good. Let's do Marsha
Marsha Marsha Bo Barsha
Banana Fanna Fo Farsha
Fe Fi Mo Arsha
Marsha

A little trick with Nick
Nick Nick Bo Bick
Banana Fanna Fo Fick
Fe Fi Mo Mick
Nick

The name game!
Do at least the ...
Tony Tony Bo Bony
Banana Fanna Fo Fony
Fe Fi Mo Mony
Tony
... part of the lyrics with other names in Python. The rules are in the song!
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 1,546
Reputation: Ene Uran has a spectacular aura about Ene Uran has a spectacular aura about 
Solved Threads: 174
Ene Uran's Avatar
Ene Uran Ene Uran is offline Offline
Posting Virtuoso

Re: Projects for the Beginner

 
1
  #54
Jun 11th, 2006
In the USA yo have the following currency options:
100 Dollars
50 Dollars
20 Dollars
10 Dollars
5 Dollars
1 Dollar ( the 2 Dollar bill is very rare, ignore it)
25 cents ( the 50 cent coin is rare, also ignore it)
10 cents
5 cents
1 cent

Let's say a customer has a charge of $161.13 and pays with two 100 Dollar bills. Write a Python program to figure out how to pay the customer his change with the least amount of currency items.
drink her pretty
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,141
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 947
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Projects for the Beginner

 
0
  #55
Jun 18th, 2006
The code below shows a simple Tkinter GUI calculation template, that has two labeled input fields, a button to trigger the calculation and a label to show the result ...
  1. # example of two labeled entries, button and result label
  2. # uses grid to position widgets also sets focus/cursor
  3. # a rather generic Tkinter GUI template for calculations
  4.  
  5. from Tkinter import *
  6.  
  7. def calculate():
  8. try:
  9. # get the enter1 and enter2 values
  10. num1 = float(enter1.get())
  11. num2 = float(enter2.get())
  12. # do the calculation
  13. result = num1 * num2
  14. # display the result string
  15. label3.config(text=str(result))
  16. except ValueError:
  17. label3.config(text='Enter numeric values!')
  18.  
  19. root = Tk()
  20. #root.config(bg='yellow')
  21.  
  22. # first entry with label
  23. label1 = Label(root, text='Enter a number:')
  24. label1.grid(row=0, column=0)
  25. enter1 = Entry(root, bg='yellow')
  26. enter1.grid(row=1, column=0)
  27.  
  28. # second entry with label
  29. label2 = Label(root, text='Enter another number:')
  30. label2.grid(row=2, column=0)
  31. enter2 = Entry(root, bg='yellow')
  32. enter2.grid(row=3, column=0)
  33.  
  34. # do the calculation by clicking the button
  35. btn1 = Button(root, text='Multiply Numbers', command=calculate)
  36. btn1.grid(row=4, column=0)
  37.  
  38. # display the result in this label
  39. label3 = Label(root)
  40. label3.grid(row=5, column=0)
  41.  
  42. # start cursor in enter1
  43. enter1.focus()
  44. # value has been entered in enter1 now switch focus to enter2
  45. enter1.bind('<Return>', func=lambda e:enter2.focus_set())
  46.  
  47. root.mainloop()
Click on "Toggle Plain Text" so you can highlight and copy the code to your editor.

You can use this template with slight modifications to do all sorts of scientific and financial calculations. You can also add more labeled Entry widgets to create a GUI based mortgage calculator. Dream up something useful or playful!
Last edited by vegaseat; Mar 1st, 2007 at 4:23 pm. Reason: [code=python] tag and comment
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 1,546
Reputation: Ene Uran has a spectacular aura about Ene Uran has a spectacular aura about 
Solved Threads: 174
Ene Uran's Avatar
Ene Uran Ene Uran is offline Offline
Posting Virtuoso

Re: Projects for the Beginner

 
0
  #56
Jun 19th, 2006
Print a 9x9 diamond shaped pattern like this
  1. *
  2. ***
  3. *****
  4. *******
  5. *********
  6. *******
  7. *****
  8. ***
  9. *
using loops.
Last edited by Ene Uran; Jun 19th, 2006 at 10:52 am.
drink her pretty
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,141
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 947
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Projects for the Beginner

 
0
  #57
Jun 25th, 2006
Simply drawing a number of geometric lines, curves or shapes on a canvas can create a fairly good looking piece of art. Of course, your art teacher might disagree, but you are a better judge anyway!

You can size, locate and color your drawing objects at random, or in a predetermined progression using a mathematical formula driven by a loop or recursive function. It's amazing what comes out of those experimentations.

Take a look at the fractal tree snippet at:
http://www.daniweb.com/code/snippet510.html

Some colorful random drawings:
http://www.daniweb.com/code/snippet384.html
Last edited by vegaseat; Jun 25th, 2006 at 3:44 pm.
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,141
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 947
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Projects for the Beginner

 
0
  #58
Jul 1st, 2006
Write a program that goes through a given directory and writes a log file containing all the filenames, modification times and filesizes. Then on a later date, the program will check this log file to detect any changes in the directory of modification dates, file sizes, new files and deleted files. It will let the user know of any changes.
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 1,221
Reputation: bumsfeld will become famous soon enough bumsfeld will become famous soon enough 
Solved Threads: 138
bumsfeld's Avatar
bumsfeld bumsfeld is offline Offline
Nearly a Posting Virtuoso

Re: Projects for the Beginner

 
0
  #59
Jul 2nd, 2006
Imagine robot arm with three pulse driven motors. One motor for each axis (x = left/right, y = up/down, z = depth). Positive pulse goes 1/10 unit (cm or inch) in one direction, negative pulse in opposite direction.

At the end of the robot arm is woodcutting tool (router). Write Python program to make the tool cut one semisphere from solid block of wood (20x20x10 units).
Last edited by bumsfeld; Jul 2nd, 2006 at 11:42 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 1,546
Reputation: Ene Uran has a spectacular aura about Ene Uran has a spectacular aura about 
Solved Threads: 174
Ene Uran's Avatar
Ene Uran Ene Uran is offline Offline
Posting Virtuoso

Re: Projects for the Beginner

 
0
  #60
Jul 21st, 2006
Write a program to show all the files in a given drive that have been modified in the last 24 hours.
drink her pretty
Reply With Quote Quick reply to this message  
Reply

Tags
beginner, projects, python

Message:




Views: 101927 | Replies: 209
Thread Tools Search this Thread



Tag cloud for beginner, projects, python
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC