Question: Problem 1 Write a function that given a length in meters, calculates the corresponding length in inches, feet, yards or miles (using 4 decimal points

Problem 1 Write a function that given a length in meters, calculates the corresponding length in inches, feet, yards or miles (using 4 decimal points for the conversion factors). Then print the output in the form ... meters is equivalent to ... for 640 meters. In [ ]: # Write the function here def convert_length(length, units): "Convert length from meters to other units." # YOUR CODE HERE raise Not ImplementedError() return clength In [ ]: from nose. tools import assert_equal assert_equal(convert_length(640, 'inches'), 640 * 39.37) assert_equal(convert_length(640, 'feet'), 640 * 3.2808) assert_equal(convert_length(640, 'yards'), 640 * 1.0936) assert_equal(convert_length(640, 'miles'), 640 * 0.0006) In [ ]: # YOUR CODE HERE raise Not ImplementedError()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
