15,883,855 members
See more:
Couldn’t write down the program.
If you run a race with 10 kilometer in 43 minutes 30 seconds, Write a program that satisfies the following requirements.

a) Store all given inputs in variables (distance, and time).

b) Calculate the average speed in kilometer per minutes, print the output.

c) Calculate the time in seconds.

d) Calculate the average speed in kilometer per seconds, print the output.

e) Write a function converts from kilometer to miles.

(Hint: there are 1.61 kilometers in a mile).

f) Calculate the average speed in miles per minute? print the output.

What I have tried:

Tried to solve but couldn’t.
By using Python 3
Posted
Updated 10-Jun-20 20:55pm
PIEBALDconsult 10-Jun-20 16:52pm

## Solution 1

First of all, congratulations! 43'30" it is a pretty good time for running 10 km. :-)
Python
```# point (1)
distance = 10 # distance in kilometers
minutes = 43.5 # time in minutes
# point (2)
average_speed = distance / minutes # average speed in kilometers per minute
print("average speed {:6.3f} km/min".format(average_speed))
# ...```

Now, completing it is up to you.

## Solution 2

I have the solution for you
Following Python code is the solution to your problem statement :

Python
```#a) Store all given inputs in variables (distance, and time).
distance=float(input("Enter the Distance : "))
time=float(input("Enter the time in minutes : "))

#b) Calculate the average speed in kilometer per minutes, print the output.
average_speed=distance/time
print("Average speed in kilometer per minutes : ",average_speed)

#c) Calculate the time in seconds.
seconds=time*60
print("Time In Seconds : ",seconds)

#d) Calculate the average speed in kilometer per seconds, print the output.
kmperseconds=average_speed/60
print("Average speed in kilometer per seconds : ",kmperseconds)

#e) Write a function converts from kilometer to miles.
#(Hint: there are 1.61 kilometers in a mile).

def kilometersToMiles(distance):
return distance/1.61
print("Kilometers to Miles : ",kilometersToMiles(distance))

#f) Calculate the average speed in miles per minute? print the output.
avgspeedInMiles=kilometersToMiles(distance)/time
print("Average Speed In Miles Per Minutes : ",avgspeedInMiles)```

Richard MacCutchan 11-Jun-20 4:31am
Writing people's complete assignments for them is not helpful. Either to them, or future posters, who think CodeProject provides an assignment writing service.
ishan_shah 15-Jun-20 1:50am
Sorry, sir. Next time I will keep awareness to post only a particular point or question's answer instead of post the whole assignment