← Back to User Input
Question 202
Trip Planner
Trip Planner
Plan a road trip from four prompted values, each prompt ending in a space and each value converted with float(): Distance in km? , Speed in km/h? , Litres per 100 km? and Price per litre? . Then print three lines: Time: <distance divided by speed> hours with one decimal, Fuel: <distance divided by 100 times the economy> litres with one decimal, and Cost: <litres times price> with two decimals. Input: four lines in that order. The prompts are part of the output and input() does not move to a new line, so all four prompts and the Time line share the first output line, as shown in Expected Output.
Expected Output:
Distance in km? Speed in km/h? Litres per 100 km? Price per litre? Time: 3.0 hours Fuel: 24.0 litres Cost: 36.00
= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
User Input
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.