Beginner Code

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

Join Date: Oct 2008
Posts: 5
Reputation: XxAaronxX is an unknown quantity at this point 
Solved Threads: 0
XxAaronxX XxAaronxX is offline Offline
Newbie Poster

Re: Projects for the Beginner

 
0
  #1
Oct 31st, 2008
Originally Posted by vegaseat View Post
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)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC