I need help with my code. Im kind of new to program and i need to do a final project for my class. I decided to do a converter program because i thought it would be sort of easy and challenging at the same time. but i wrote the program but its not working could someone help!!! Here is what i have can you see if im doing it write or what please.
def inches(start):
convert_to = [["feet", 0], ["miles", 0], ["millimeters",0],
["centimeters", 0], ["meters", 0], ["kilometers", 0], ["yards",0]]
for item in convert_to:
print item[0]
end = raw_input("Convert to? feet, miles, millimeters, centimeters, meters, kilometers, yards")
value = input("Value? ")
convert_to[0][1] = value * 0.0833333 ## feet
convert_to[1][1] = value * 0.000015783 ## miles
convert_to[2][1] = value * 25.4 ## millimeters
convert_to[3][1] = value * 2.54 ## centimeters
convert_to[4][1] = value * 0.0254 ## meters
convert_to[5][1] = value * 0.0000254 ## kilometers
convert_to[6][1] = value * 0.0277778 ## yards
for item in convert_to:
if end == item[0]:
print "%s to %s, %7.2f = %7.2f" % (start, end, value, item[1])
start = raw_input ("Convert from? inches, feet, miles, millimeters, centimeters, meters, kilometers, yards")
inches(start)
def feet(start):
convert_to = [["inches", 0], ["miles", 0], ["millimeters",0],
["centimeters", 0], ["meters", 0], ["kilometers", 0], ["yards",0]]
for item in convert_to:
print item[0]
end = raw_input("Convert to? inches, miles, millimeters, centimeters, meters, kilometers, yards")
value = input("Value? ")
convert_to[0][1] = value * 12.0 ## inches
convert_to[1][1] = value * 0.000189394 ## miles
convert_to[2][1] = value * 304.8 ## millimeters
convert_to[3][1] = value * 30.48 ## centimeters
convert_to[4][1] = value * 0.3048 ## meters
convert_to[5][1] = value * 0.0003048 ## kilometers
convert_to[6][1] = value * 0.333333 ## yards
for item in convert_to:
if end == item[0]:
print "%s to %s, %7.2f = %7.2f" % (start, end, value, item[1])
start = raw_input ("Convert from? inches, feet, miles, millimeters, centimeters, meters, kilometers, yards ")
feet(start)
def miles(start):
convert_to = [["feet", 0], ["inches", 0], ["millimeters",0],
["centimeters", 0], ["meters", 0], ["kilometers", 0], ["yards",0]]
for item in convert_to:
print item[0]
end = raw_input("Convert to? inches, feet, millimeters, centimeters, meters, kilometers, yards")
value = input("Value? ")
convert_to[0][1] = value * 5280.0 ## feet
convert_to[1][1] = value * 63360.0 ## inches
convert_to[2][1] = value * 1609000.0 ## millimeters
convert_to[3][1] = value * 160934.0 ## centimeters
convert_to[4][1] = value * 1609.34 ## meters
convert_to[5][1] = value * 1.60934 ## kilometers
convert_to[6][1] = value * 1760.0 ## yards
for item in convert_to:
if end == item[0]:
print "%s to %s, %7.2f = %7.2f" % (start, end, value, item[1])
start = raw_input ("Convert from? inches, feet, miles, millimeters, centimeters, meters, kilometers, yards ")
miles(start)
def millimeters(start):
convert_to = [["feet", 0], ["miles", 0], ["inches",0],
["centimeters", 0], ["meters", 0], ["kilometers", 0], ["yards",0]]
for item in convert_to:
print item[0]
end = raw_input("Convert to? inches, feet, miles, centimeters, meters, kilometers, yards")
value = input("Value? ")
convert_to[0][1] = value * 0.00328084 ## feet
convert_to[1][1] = value * 0.00000062137 ## miles
convert_to[2][1] = value * 0.0393701 ## inches
convert_to[3][1] = value * 0.1 ## centimeters
convert_to[4][1] = value * 0.001 ## meters
convert_to[5][1] = value * 0.000001 ## kilometers
convert_to[6][1] = value * 0.00109361 ## yards
for item in convert_to:
if end == item[0]:
print "%s to %s, %7.2f = %7.2f" % (start, end, value, item[1])
start = raw_input ("Convert from? inches, feet, miles, millimeters, centimeters, meters, kilometers, yards ")
millimeters(start)
def centimeters(start):
convert_to = [["feet", 0], ["miles", 0], ["millimeters",0],
["inches", 0], ["meters", 0], ["kilometers", 0], ["yards",0]]
for item in convert_to:
print item[0]
end = raw_input("Convert to? inches, feet, miles, millimeters, meters, kilometers, yards")
value = input("Value? ")
convert_to[0][1] = value * 0.0328084 ## feet
convert_to[1][1] = value * 0.0000062137 ## miles
convert_to[2][1] = value * 10.0 ## millimeters
convert_to[3][1] = value * 0.393701 ## inches
convert_to[4][1] = value * 0.01 ## meters
convert_to[5][1] = value * 0.00001 ## kilometers
convert_to[6][1] = value * 0.0109361 ## yards
for item in convert_to:
if end == item[0]:
print "%s to %s, %7.2f = %7.2f" % (start, end, value, item[1])
start = raw_input ("Convert from? inches, feet, miles, millimeters, centimeters, meters, kilometers, yards ")
centimeters(start)
def meters(start):
convert_to = [["feet", 0], ["miles", 0], ["millimeters",0],
["centimeters", 0], ["inches", 0], ["kilometers", 0], ["yards",0]]
for item in convert_to:
print item[0]
end = raw_input("Convert to? inches, feet, miles, millimeters, centimeters, kilometers, yards")
value = input("Value? ")
convert_to[0][1] = value * 3.28084 ## feet
convert_to[1][1] = value * 0.000621371 ## miles
convert_to[2][1] = value * 1000.0 ## millimeters
convert_to[3][1] = value * 100.0 ## centimeters
convert_to[4][1] = value * 39.3701 ## inches
convert_to[5][1] = value * 0.001 ## kilometers
convert_to[6][1] = value * 1.09361 ## yards
for item in convert_to:
if end == item[0]:
print "%s to %s, %7.2f = %7.2f" % (start, end, value, item[1])
start = raw_input ("Convert from? inches, feet, miles, millimeters, centimeters, meters, kilometers, yards ")
meters(start)
def kilometers(start):
convert_to = [["feet", 0], ["miles", 0], ["millimeters",0],
["centimeters", 0], ["meters", 0], ["inches", 0], ["yards",0]]
for item in convert_to:
print item[0]
end = raw_input("Convert to? inches, feet, miles, millimeters, centimeters, meters, yards ")
value = input("Value? ")
convert_to[0][1] = value * 3280.84 ## feet
convert_to[1][1] = value * 0.621371 ## miles
convert_to[2][1] = value * 1000000.0 ## millimeters
convert_to[3][1] = value * 100000.0 ## centimeters
convert_to[4][1] = value * 1000.0 ## meters
convert_to[5][1] = value * 39370.1 ## inches
convert_to[6][1] = value * 1093.61 ## yards
for item in convert_to:
if end == item[0]:
print "%s to %s, %7.2f = %7.2f" % (start, end, value, item[1])
start = raw_input ("Convert from? inches, feet, miles, millimeters, centimeters, meters, kilometers, yards")
kilometers(start)
def yards(start)
convert_to = [["feet", 0], ["miles", 0], ["millimeters",0],
["centimeters", 0], ["meters", 0], ["kilometers", 0], ["inches",0]]
for item in convert_to:
print item[0]
end = raw_input("Convert to? inches, feet, miles, millimeters, centimeters, meters, kilometers")
value = input("Value? ")
convert_to[0][1] = value * 3.0 ## feet
convert_to[1][1] = value * 0.000568182 ## miles
convert_to[2][1] = value * 914.4 ## millimeters
convert_to[3][1] = value * 91.44 ## centimeters
convert_to[4][1] = value * 0.9144 ## meters
convert_to[5][1] = value * 0.0009144 ## kilometers
convert_to[6][1] = value * 36.0 ## inches
for item in convert_to:
if end == item[0]:
print "%s to %s, %7.2f = %7.2f" % (start, end, value, item[1])
start = raw_input ("Convert from? inches, feet, miles, millimeters, centimeters, meters, kilometers, yards")
yards(start)