Question: PYTHON QUESTION!!! Purpose: To write a function that performs a subtask and returns an answer. Degree of Difficulty: Easy In Physics the speed of a
PYTHON QUESTION!!!
Purpose: To write a function that performs a subtask and returns an answer. Degree of Difficulty: Easy In Physics the speed of a moving object can be calculated by dividing the distance traveled by the time taken: speed = distance time Write a Python function named calculate_speed which has two parameters (distance and time) and returns the value of speed. Also write a main program that reads the two necessary values from the user, passes the entered values to the calculate_speed function to perform the computation, obtains the function's return value, then prints a message to the console that reports the value of speed. Your function calculate_speed should do no console input and no console output. It must receive its input through its parameters and send its output using a return value. Sample Run Here is an example of how your program's console output might look. Green text was entered by the user blue text came from data returned by the calculate_speed function. Calculate Speed Enter desired distance (km) 510 Enter desired time (houhours you sust travel at 102 k/h In order to travel 510 km in 5 hours you must travel at 102 km/h The above shows the result of traveling 510 km over 5 hours
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
