| | |
Beginner Code
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2008
Posts: 5
Reputation:
Solved Threads: 0
•
•
•
•
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
- Beginner in Code for Web Development? (IT Professionals' Lounge)
- PHP Beginner Here (PHP)
- Need help with small beginner program, please. (C)
- need C++ program explained. I am a beginner (C++)
- Need help with including C++ code in Word macro (C++)
Other Threads in the Python Forum
- Previous Thread: A simple Monthly Calendar Display
- Next Thread: File I/O Problem: Incomplete or Missing Content During Writeline
Views: 188 | Replies: 0
| Thread Tools | Search this Thread |
Tag cloud for Python
approximation array beginner book builtin change cipher clear client code color converter countpasswordentry cturtle curved def dictionary drive dynamic examples excel file float format ftp function gui homework import inches input java library line lines linux list lists loop microcontroller mouse mysqldb mysqlquery newb number numbers output parsing path plugin port prime program programming projects py2exe pygame pymailer pyqt python random recursion recursive redirect remote script scrolledtext search singleton socket sqlite ssh string strings strip subprocess sum syntax table terminal text textarea thread threading time tkinter tlapse tuple tutorial twoup ubuntu unicode urllib urllib2 variable vigenere wikipedia windows wxpython xlwt





