This program is supposed to solve the problem of converting different units of length. For some reason the program only responds to the first "if" statement and runs the "meters_to_inches" and "meters_to_centimeters" functions only, even if the user inputs that they have inches or centimeters. If the user types in "meters" and then the length, it returns what it is supposed to, which is the length in inches and centimeters. But if the user wants to convert from inches or centimeters, it still uses the math from the meters functions and is not taking the elif statements. Can someone please help me?
#Title
print "Length Conversion"
#Description
print "This application will calculate the conversion of different units of length. There will be different conversion factors as described in the application."
print '\n'
#Directions
print "Hello. This application will help you convert into different units of lenth."
print '\n'
#Question
print "These are the different units to convert to and from:"
list = ["-Meters", "-Inches", "-Centimeters"]
for unit in list:
print unit
print '\n'
#Question
units = raw_input("Which of these units do you have and would like to convert to one or both of the other two?")
print '\n'
amount = int(raw_input("How much of it do you have?"))
#Functions. One of these functions converts meters to inches, and the other converts meters to centimers. The original input gets muultiplied or divided by a certain number in order for it to be converted.
def meters_to_inches(amount):
number = amount / 0.0254
return number
def meters_to_centimeters(amount):
number = amount * 100
return number
#Functions. One of these functions converts inches to meters, and the other converts inches to centimers. The original input gets muultiplied or divided by a certain number in order for it to be converted.
def inches_to_meters(amount):
number = amount * 0.0254
return number
def inches_to_centimeters(amount):
number = amount * 2.54
return number
#Functions. One of these functions converts centimeters to meters, and the other converts centimeters to inches. The original input gets muultiplied or divided by a certain number in order for it to be converted.
def centimeters_to_meters(amount):
number = amount / 100
return number
def centimeters_to_inches(amount):
number = amount / 2.54
return number
if units == "Meters" or "meters":
print meters_to_inches(amount)
print "(inches)"
print'\n'
print meters_to_centimeters(amount)
print "(centimeters)"
elif units == "Inches" or "inches":
print inches_to_meters(amount)
print "(meters)"
print'\n'
print inches_to_centimeters(amount)
print "(centimeters)"
elif units == "Centimeters" or "centimeters":
print centimeters_to_inches(amount)
print "(inches)"
print '\n'
print centimeters_to_meters(amount)
print "(meters)"
else:
print "The unit you have given does not match a conversion this application provides"