943,879 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 268
  • Python RSS
Oct 31st, 2008
0

Re: Projects for the Beginner

Expand Post »
Click to Expand / Collapse  Quote originally posted by vegaseat ...
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?"

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)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
XxAaronxX is offline Offline
5 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: A simple Monthly Calendar Display
Next Thread in Python Forum Timeline: File I/O Problem: Incomplete or Missing Content During Writeline





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC