In python. Please explain each line of code by commenting it out. Make sure to have functions for each calculation and for the user defined inputs. MAKE SURE IT MATCHES THE NEEDED FORMULAS

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
In python. Please explain each line of code by commenting it out. Make sure to have functions for each calculation and for the user defined inputs. MAKE SURE IT MATCHES THE NEEDED FORMULAS
Write a program to convert a US Customary System
length in miles, yards, feet and inches to a Metric
System length in kilometers meters, and centimeters.
A sample run is seen in grey from the figure. After
the numbers of miles, yards, feet and inchers are
entered, the length should be converted entirely to
inches and then divided by 39.37 to obtain the value
in meters. The int function should be used to break
the total meters into a whole number of kilometers
and meters. The number centimeters should be
displayed to one decimal place. The needed formulas
are as follows:
Total_inches = 63360*miles + 36*yards + 12*feet +
inches
Total_meters = total_inches/39.37
kilometers = int(total_meters/1000)
You will need to write out the rest of the numbers in
meters left over after converting to kilometer. For
example if the total meters calculated is
6035.358765. Your out should be 6 kilometers, 35
meters and 35.9 centimeters. Make sure to have
functions for each calculations and for the user
efined inputs. Check to make sure that user inputs
are a number and not a character.
Enter number of miles: 5
Enter number of yards: 20
Enter number of feet: 2
Enter number of inches: 4
Metric length:
8 kilometers
65 meters
73.5 centimeters
Transcribed Image Text:Write a program to convert a US Customary System length in miles, yards, feet and inches to a Metric System length in kilometers meters, and centimeters. A sample run is seen in grey from the figure. After the numbers of miles, yards, feet and inchers are entered, the length should be converted entirely to inches and then divided by 39.37 to obtain the value in meters. The int function should be used to break the total meters into a whole number of kilometers and meters. The number centimeters should be displayed to one decimal place. The needed formulas are as follows: Total_inches = 63360*miles + 36*yards + 12*feet + inches Total_meters = total_inches/39.37 kilometers = int(total_meters/1000) You will need to write out the rest of the numbers in meters left over after converting to kilometer. For example if the total meters calculated is 6035.358765. Your out should be 6 kilometers, 35 meters and 35.9 centimeters. Make sure to have functions for each calculations and for the user efined inputs. Check to make sure that user inputs are a number and not a character. Enter number of miles: 5 Enter number of yards: 20 Enter number of feet: 2 Enter number of inches: 4 Metric length: 8 kilometers 65 meters 73.5 centimeters
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY