Average Speed
Programming Basics · Python
TASK
Problem
Given distance `s` and time `t`, print average speed `s / t`.
EXAMPLE
Example
150 3
50.0
LIMITS
Constraints
s ≥ 0; t > 0
LEARN
Theory for this problem
+
`input()` reads data entered by the user. The result of `input()` is initially a string. `split()` separates one input line into individual values using spaces. `map()` applies the specified conversion to each input value. The `/` operator performs regular division and may return a decimal number. `print()` displays the program result. Print only what the problem statement requires.
**Connection to this task.** The `/` operator performs true division and returns a floating-point value in Python. This matters for averages, percentages, and formulas whose result may be fractional. The expression `s / t` shows how this idea is applied to the task data.
NEED HELP?
Hints
+
['Divide distance by time.']
ANSWER
Solution
+
s, t = map(float, input().split()) result = s / t print(result)