| | |
Projects for the Beginner
![]() |
•
•
Join Date: Oct 2008
Posts: 45
Reputation:
Solved Threads: 6
•
•
•
•
Hi,
This is the first Python code i have written without the aid of a tutorial, i was wondering if you could look over it and provide me with your feed back on any bad habits i may have and if there was an easier way to write this, Your feedback would be greatly appreciated.
Thanks
import time
print "Welcome to my measurement converter"
print "This converter will convert meters into yards"
Meters = int(raw_input("Enter the number of meters"))
Yards = Meters * 1.094
print Meters, "Meters is equal to", Yards, "yards"
time.sleep(5)
Why don't you post it in a new thread so that we don't muddy up the tutorial thread with random comments.
Editor: Thanks, this post has been moved to its own thread.
Last edited by vegaseat; Dec 19th, 2008 at 12:03 pm.
I wish I had something cool to put here...
Python is very well suited for text modifications. Write a small Python program that modifes this typical email text:
To a more normal text like this:
Notice that something like JOHN McCAIN: --> John McCain: needs special attention.
Python Syntax (Toggle Plain Text)
Why did the chicken cross the road? > > > BARACK OBAMA: >> The chicken crossed the road because it was time for a > CHANGE! The chicken wanted CHANGE! > > > JOHN McCAIN: >> My friends, that chicken crossed the road because he > recognized the need to engage in cooperation and dialogue > with all the chickens on the other side of the road. > > > HILLARY CLINTON: > When I was First Lady, I personally helped that little > chicken to cross the road. This experience makes me > uniquely qualified to ensure -- right from Day One! -- that > every chicken in this country gets the chance it deserves to > cross the road. But then, this really isn't about me.... > > > GEORGE W. BUSH: > We don't really care why the chicken crossed the road. > We just want to know if the chicken is on our side of the > road or not. The chicken is either against us or for us. > There is no middle ground here. > > > COLIN POWELL: > Now to the left of the screen, you can clearly see the > satellite image of the chicken crossing the road... > > > JOHN KERRY: > Although I voted to let the chicken cross the road, I am > now against it! It was the wrong road to cross, and I was > misled about the chicken's intentions. I am not for it > now, and will remain against it. > > > BILL CLINTON: > I did not cross that road with THAT chicken!!!! .... What, > exactly, is your definition of chicken? > > > AL GORE: > I invented the chicken! > > > DICK CHENEY: > Where's my gun? > > > ANDERSON COOPER: > We have reason to believe there is a chicken, but we have > not yet been allowed to have access to the other side of the > road. > > > PAT BUCHANAN: > To steal the job of a decent, hard-working American. > > > BARBARA WALTERS: > Isn't that interesting? In a few moments, we will be > listening to the chicken tell, for the first time, the > heart-warming story of how it experienced a serious case of > molting, and went on to accomplish its life long dream of > crossing the road. > > > OPRAH WINFREY: > Well, I understand that the chicken is having problems, > which is why he wants to cross this road so bad. So instead > of having the chicken learn from his mistakes and take > falls, which is a part of life, I'm going to give this > chicken a car so that he can just drive across the road and > not live his life like the rest of the chickens. > > > DR. PHIL: > The problem we have here is that this chicken won't > realize that he must first deal with the problem on > 'THIS' side of the road before it goes after the > problem on the 'OTHER SIDE' of the road. What we > need to do is help him realize how stupid he's acting by > not taking on his 'CURRENT' problems before adding > 'NEW' problems. > > > MARTHA STEWART: > No one called me to warn me which way that chicken was > going. I had a standing order at the Farmer's Market to > sell my eggs when the price dropped to a certain level. No > little bird gave me any insider information. > > > NANCY GRACE: > That chicken crossed the road because he's GUILTY! You > can see it in his eyes and the way he walks. > > > BILL GATES: > I have just released eChicken2008, which will not only > cross roads, but will lay eggs, file your important > documents, and balance your check book. Internet Explorer is > an integral pa rt of eChicken. This new platform is much > more stable and will never crash. > > > GRANDPA: > In my day, we didn't ask why the chicken crossed the > road. Somebody told us the chicken crossed the road, and > that was good enough. > > > DR. SEUSS: > Did the chicken cross the road? Did he cross it with a > toad? Yes, the chicken crossed the road, but why it crossed > I've not been told. > > > ERNEST HEMINGWAY: > To die in the rain. Alone. > > > ARISTOTLE: > It is the nature of chickens to cross the road. > > > JOHN LENNON: > Imagine all the chickens in the world crossing roads > together, in peace. > > > ALBERT EINSTEIN: > Did the chicken really cross the road, or did the road move > beneath the chicken? > > > COLONEL SANDERS: > Did I miss one?
Python Syntax (Toggle Plain Text)
Why did the chicken cross the road? Barack Obama: The chicken crossed the road because it was time for a CHANGE! The chicken wanted CHANGE! John McCcain: My friends, that chicken crossed the road because he recognized the need to engage in cooperation and dialogue with all the chickens on the other side of the road. Hillary Clinton: When I was First Lady, I personally helped that little chicken to cross the road. This experience makes me uniquely qualified to ensure -- right from Day One! -- that every chicken in this country gets the chance it deserves to cross the road. But then, this really isn't about me.... George W. Bush: We don't really care why the chicken crossed the road. We just want to know if the chicken is on our side of the road or not. The chicken is either against us or for us. There is no middle ground here. Colin Powell: Now to the left of the screen, you can clearly see the satellite image of the chicken crossing the road... John Kerry: Although I voted to let the chicken cross the road, I am now against it! It was the wrong road to cross, and I was misled about the chicken's intentions. I am not for it now, and will remain against it. Bill Clinton: I did not cross that road with THAT chicken!!!! .... What, exactly, is your definition of chicken? Al Gore: I invented the chicken! Dick Cheney: Where's my gun? Anderson Cooper: We have reason to believe there is a chicken, but we have not yet been allowed to have access to the other side of the road. Pat Buchanan: To steal the job of a decent, hard-working American. Barbara Walters: Isn't that interesting? In a few moments, we will be listening to the chicken tell, for the first time, the heart-warming story of how it experienced a serious case of molting, and went on to accomplish its life long dream of crossing the road. Oprah Winfrey: Well, I understand that the chicken is having problems, which is why he wants to cross this road so bad. So instead of having the chicken learn from his mistakes and take falls, which is a part of life, I'm going to give this chicken a car so that he can just drive across the road and not live his life like the rest of the chickens. Dr. Phil: The problem we have here is that this chicken won't realize that he must first deal with the problem on 'THIS' side of the road before it goes after the problem on the 'OTHER SIDE' of the road. What we need to do is help him realize how stupid he's acting by not taking on his 'CURRENT' problems before adding 'NEW' problems. Martha Stewart: No one called me to warn me which way that chicken was going. I had a standing order at the Farmer's Market to sell my eggs when the price dropped to a certain level. No little bird gave me any insider information. Nancy Grace: That chicken crossed the road because he's GUILTY! You can see it in his eyes and the way he walks. Bill Gates: I have just released eChicken2008, which will not only cross roads, but will lay eggs, file your important documents, and balance your check book. Internet Explorer is an integral pa rt of eChicken. This new platform is much more stable and will never crash. Grandpa: In my day, we didn't ask why the chicken crossed the road. Somebody told us the chicken crossed the road, and that was good enough. Dr. Seuss: Did the chicken cross the road? Did he cross it with a toad? Yes, the chicken crossed the road, but why it crossed I've not been told. Ernest Hemingway: To die in the rain. Alone. Aristotle: It is the nature of chickens to cross the road. John Lennon: Imagine all the chickens in the world crossing roads together, in peace. Albert Einstein: Did the chicken really cross the road, or did the road move beneath the chicken? Colonel Sanders: Did I miss one?
Last edited by sneekula; Oct 31st, 2008 at 12:30 pm.
No one died when Clinton lied.
How about making a program that will get your weather forecast for tomorrow?
You can use modules such as urllib2 and things like that to get the source code of your favourite web weather forecaster and then scrape off all of the html tags to leave you with your forecast for the next few days.
You can use modules such as urllib2 and things like that to get the source code of your favourite web weather forecaster and then scrape off all of the html tags to leave you with your forecast for the next few days.
Last edited by Paul Thompson; Nov 4th, 2008 at 4:38 pm.
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
Let's have some fun with mathematics, write a Python program for each question:
1) What do you get when you add up the numbers 1-100 consecutively?
2) What number multiplied by itself gives the number 12345678987654321?
3) What five digit number, when multiplied by the number 4, gives a number with the digits in reverse order?
1) What do you get when you add up the numbers 1-100 consecutively?
2) What number multiplied by itself gives the number 12345678987654321?
3) What five digit number, when multiplied by the number 4, gives a number with the digits in reverse order?
May 'the Google' be with you!
Write a simple calendar program. One that will remember dates that you have set. For this you would have to save it in some place.
Perhaps take a look at Pickle modules. This can be used to save instances and the like.
This program could be used very well in a GUI in fact wxPython has a specific built in object for making a calendar...
Perhaps take a look at Pickle modules. This can be used to save instances and the like.
This program could be used very well in a GUI in fact wxPython has a specific built in object for making a calendar...
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
Write a programmer's calculator that shows a numeric integer entry in denary (base10), binary(base2), octal(base8) and hexadecimal (base16). Allow entry in any of these bases.
Also does some simple binary stuff like shift-left and shift-right, binary or, binary and and binary xor.
If the integer falls into the ASCII range, display its character or meaning.
Also does some simple binary stuff like shift-left and shift-right, binary or, binary and and binary xor.
If the integer falls into the ASCII range, display its character or meaning.
No one died when Clinton lied.
Write a program that gets that latest comic from your favourite webcomic.
For this you could use urllib to download the images.
For this you could use urllib to download the images.
Last edited by Paul Thompson; Dec 26th, 2008 at 3:35 pm.
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
![]() |
Similar Threads
- 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: Wing IDE & IronPython
- Next Thread: Printing dictionary sorted by value
| Thread Tools | Search this Thread |
.dll .net .so abrupt address advanced advice anti apax applicationreengineering array asp.net avogadro backend beginner bluetooth c++ calculator calling code college curved cx-freeze def dheeraj dynamic event examples excel file forms function google gui http images input itunes java javaprojects launcher library link linux list loop mca microphone microsoft mouse movingimageswithpygame newb newbie number opensource output outsourcing php prime programming projects push py2exe pygame pyglet pyqt python random recursive remote return rubyconf script silverlight slicenotation softwaredevelopment source sqlite string sum suthar syntax table text threading tlapse tooltip tricks tutorial ubuntu url urllib urllib2 variable vb.net webdevelopemnt whileloop wikipedia wxpython xlwt







