Question: SUBMIT original code in Python to solve the problem belon. Please be aware that copring and pasting code from any other source other than code

SUBMIT original code in Python to solve the problem belon.
Please be aware that copring and pasting code from any other source other than code you have explicitly written on your own is considered plagiarism. fyou receive help, that is fine (document help in the comments of your code) however you need to write your own code, name your own variables, and comment your own code. Students turing in the exact same work as another student will all be given zeros. Plagiarism is not tolerated, and students found to be plagiarizing will be given a zero and reported to the University with the possibility of termination of the class and degree program.
Write a program that asks the user to enter a distance number, and the unit of distances, either KM (kilometers) or MI (miles), and then converts that distance to the other metric:
If the user enters a number and 'KM', the output should be the entered distance converted to miles
If the user enters a number and 'MI', the output should be the entered distance converted to kilometers
You can use the following formula for conversion:
Miles = Kilometers X 0.6214
Kilometers = Miles X 1.6093
The requirement for your program is as follows:
Both conversions must be written as functions to be called by the main program
The program must handle incorrect inputs from users. Specifically, the user must type in correct float numbers in the first input, and either KM' or MI*(case-sensitive) in the second input. Incorrect inputs should not cause errors and instead should trigger a new request to the user to type again until the input is correct.
In the below example, highlighted texts are from the program, and bolded texts are inputs from users.
Example 1:
Please enter a float number:
1.0
Please enter a unit: KM
The entered distance is 0.6214 Miles
Example 2:
Please enter a float number:
1.0
Please enter a unit: MI
The entered distance is 1.6093 Kilometers
Example 3:
Please enter a float number: 1.111abdfs
Please enter a correct float number:
Please enter a correct float number:
1.423.1111
1.0
Please enter a unit:
KM
The entered distance is 0.6214 Miles
Example 4:
Please enter a float number: 1.0
Please enter a unit: abc
Please enter a correct unit (KM or MI) :
Please enter a correct unit (KM or MI): KM
The entered distance is 0.6214 Miles
Hint: please review input validation to do this assignment. You can validate the two inputs separately to make it less complicated.
Upload your source file and screenshots of outputs to D2L

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!