"""Name: Course: CS1430, Section , Spring 2023Assignment: Assignment 1Purpose: This program converts an English unit of length to ametric unit and displays the result. ...










"""






Name:






Course: CS1430, Section , Spring 2023






Assignment: Assignment 1






Purpose: This program converts an English unit of length to a









metric unit and displays the result. Conversions allowed









include inches to centimeters, yards to meters and miles









to kilometers. Errors are displayed for non-positive









values and strings other than inches, yards and miles.






Input: A float number. Non-positive values are valid. A string









value. Valid values are inches, yards and miles.






Output: A float value followed by centimeters, meters or kilometers









if the value and English unit are valid. Error messages









that can be outputted are for an invalid English unit of









measure or a non-positive value.






"""






"""






CONSTANTS






"""



_INCH_TO_CM =

2.54



_YARD_TO_METER =

0.914



_MILE_TO_KM =

1.609



_INCHES_STRING =

'inches'



_YARDS_STRING =

'yards'



_MILES_STRING =

'miles'



_CENTIMETERS_STRING =

'centimeters'



_METERS_STRING =

'meters'



_KILOMETERS_STRING =

'kilometers'



_INPUT_MEASURE_OUTPUT =

'Input a positive measure of length: '



_INPUT_UNIT_OUTPUT =

'Input inches, yards or miles as the unit of measure: '



_INVALID_MEASURE_OUTPUT =

'{:.2f} is not a valid measure of length'



_INVALID_UNIT_OUTPUT =

'{0} is not a valid unit'



_OUTPUT_STRING =

'The input length of {:.2f} {:s} is equal to {:.2f} {:s}.'






"""






Fill in a short program description here.








"""






def




main():



"""









This is your docstring - replace this with a description of the program.












:return


: None









"""












# replace the word pass with your code.












pass






"""






Do not remove the code below this line!






"""






if

__name__ ==

'__main__':
main()



Feb 23, 2023
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here