I need to design a program in Python code that asks the user for the speed of a vehicle (in MPH) and how many hours it has traveled. It should then use a loop to display the distance the vehicle has traveled for each hour of that time period.
Added by Fernando O.
Step 1
First, we need to ask the user for the speed of the vehicle and the number of hours it has traveled. We can use the input() function to get this information from the user. Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 66 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
PYTHON QUESTION Write a program that asks the user for the minutes, seconds, miles run, and miles to target from an exercise event and outputs both the average pace and the average speed and time. For example, if I run 6.3 miles in 53 minutes and 30 seconds, my average pace is 8 minutes and 29 seconds per mile, my average speed is 7.07 miles per hour and my projected time for 2.7 miles is 22 minutes and 55 seconds. Sample Output Text: Minutes ==> 53 53 Seconds ==> 30 30 Miles ==> 6.3 6.3 Target Miles ==> 2.7 2.7 Pace is 8 minutes and 29 seconds per mile. Speed is 7.07 miles per hour. Time to run the target distance of 2.70 miles is 22 minutes and 55 seconds.
Akash M.
It takes 3 hours to drive a distance of 192 km on a motor way. Create a program to calculate the average speed in km/h in Python
John B.
Design a program that calculates and displays the number of miles per hour over the speed limit that a speeding driver was doing. The program should ask for the speed limit and the driver's speed. Validate the input as follows: The speed limit should be at least 20, but not greater than 70. The driver's speed should be at least the value entered for the speed limit (otherwise the driver was not speeding). Just the basic algorithm in pseudo-code.
Willis J.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD