← Back to User Input
Question 191
Travel Time
Travel Time
Ask for a distance with the prompt Distance in km? and a speed with Speed in km/h? (each ending in a space), convert both with float(), divide the distance by the speed and print Travel time: <value> hours with one decimal using :0.1f. Input: two lines, one number each; the speed is never zero. Both prompts are part of the output and input() stays on the same line, so the prompts and the result share one output line.
Expected Output:
Distance in km? Speed in km/h? Travel time: 1.5 hours= newline. The output ends with a newline — print one after the last line.
Hints3 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.