Python 2.7.13 Unit Conversions : #The table below contains some lengths in terms of feet. 1 inch = .083333 foot; 1 rod = 16. 5 feet; 1 yard = 3.28155 feet; 1 furlong = 660 feet; 1 meter = 3.28155 feet; 1 kilometer = 3281.5 feet; 1 fathom = 6 feet; 1 mile = 5280 feet. Write a program that displays the nine different units of measure; requests the unit to convert from, the unit to convert to, and the quantity to be converted; and then displays the converted quantity. Use the file Conversions.txt to create a dictionary that provides the number of feet for a given unit of length.The conversions.txt file reads: inches, .083333; furlongs, 660; yards, 3; fathoms, 6; feet, 1; kilometers, 3281.5; meters, 3.2815; miles, 5280; rods, 16.5

    print 'UNITS OF LENGTH'
    print 'Inches',     'furlongs',     'yards'
    print 'rods',       'miles',        'fathoms'
    print 'meters',     'kilometers',   'feet'

    conversions = {}
    with open('Units.txt') as fname:
        for line in fname:
            (keys, values) = line.split(',')
            conversions[keys] = float(values)
    def convert(from_unit, to_unit, values):
        from__unit1 = conversions[from_unit1]
        to__unit2 = conversions[to_unit2]

    new_values = values * (from__unit1 / to__unit2)

    return str(new_value) + to__unit2

    unit1 = raw_input('Units to convert from: ')
    unit2 = raw_input('Units to convert to: ')
    num1 = raw_input('Enter your value: ')
    
    print(convert(unit1, unit2, (num1)))

