[Tutor] Converter

wackedd at mac.com wackedd at mac.com
Thu Mar 20 01:55:49 CET 2008


print "Converter"
number = 2.5
n = int(raw_input("Insert Feet Amount"))
while n > 0:
        print n, "Feet is"
        print n*12, "inches"
        print n*30, "centimeters"
print

Currently this is what I am working with.
2 problems I am facing.
1. When I run the script and type in the amount of feet it calculates it OVER AND OVER.

ex: 1 Feet is
12 inches
30 centimeters
1 Feet is
12 inches
30 centimeters
1 Feet is

2. Currently this script only works for the amount of feet, is their a way to have it choose feet, inches, to convert into whatever, without having to right the script over and over, and all in different programs. Maybe using if raw_input = feet then do this equation. I am coding in pure Python on my mac, so please nothing in C as  have been some answers I have received.
Thanks


More information about the Tutor mailing list