Answer to Question #261985 in Python for khaled

Question #261985

Instructions: You should submit your answer to this question as a Python code

with .py extension to the corresponding question in Google Classroom.

Attention: Make sure to write your name, surname, and student ID number.

Question:

(Average speed) Assume a runner runs 14 kilometers in 45 minutes and 30 sec-

onds. Write a program that displays the average speed in miles per hour. (Note that

 1 mile is 1.6 kilometers.)


1
Expert's answer
2021-11-07T14:52:54-0500


SOLUTION TO THE ABOVE QUESTION


SOLUTION CODE


#A ruuner runs 14 km in 45 minutes 30 seconds
#45 minutes 30 seconds is equal to 45.5minutes and 1 mile is equal to 1.6 kilometers
total_distance_in_km = 14
time_in_minutes = 45.5;
#Now lets convert 14 kilometers to miles
total_distance_in_miles = total_distance_in_km/1.6
#45.5 minutes == 45.5/60 hours
time_in_hours = (45.5/60)
#lets clculate the avreage speed in miles per hour
average_speed_in_miles_per_hour = total_distance_in_miles/time_in_hours;
#format the average speed in miles per hour to 4 decimal places
average_speed_in_miles_per_hour = float("{0:.4f}".format(average_speed_in_miles_per_hour))
#Now print the runnes average speed in miles
print("\nThe runners average speed in miles per hour = "+str(average_speed_in_miles_per_hour))



SAMPLE PROGRAM OUTPUT







Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS