Kilometres to Metres
Programming Basics · Python
TASK
Problem
Given an integer number of kilometres `km`, convert it to metres.
EXAMPLE
Example
7
7000
LIMITS
Constraints
All integer inputs have absolute value at most 10^9; any additional relationships between them are stated directly in the task.
LEARN
Theory for this problem
+
`input()` reads data entered by the user. The result of `input()` is initially a string. `int()` converts a numeric string into an integer. The `*` operator multiplies numbers. `print()` displays the program result. Print only what the problem statement requires.
**Connection to this task.** The `*` operator multiplies numeric values. In formulas it naturally models repeated contribution, such as price × quantity, speed × time, or side × side. The expression `km * 1000` shows how this idea is applied to the task data.
NEED HELP?
Hints
+
['One kilometre contains 1000 metres.']
ANSWER
Solution
+
km = int(input()) result = km * 1000 print(result)