Number of Hundreds
Programming Basics · Python
TASK
Problem
Given non-negative integer `n`, print complete hundreds.
EXAMPLE
Example
9876
98
LIMITS
Constraints
Quantities, prices, and balances are integers from 0 to 10^9; other integer inputs have absolute value at most 10^9.
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 performs integer division and keeps the whole-number part. `print()` displays the program result. Print only what the problem statement requires.
**Connection to this task.** The `//` operator performs floor integer division. It is useful for counting how many complete groups of a fixed size fit into a value. The expression `n // 100` shows how this idea is applied to the task data.
For this task, pay special attention to `int(input())`: it connects the concept above to the concrete computation or program action.
**Focus: “Number of Hundreds”.** The same basic mechanism is used in a different context here, so understand the operation itself rather than memorizing a finished line of code.
NEED HELP?
Hints
+
['Use `n // 100`.']
ANSWER
Solution
+
n = int(input()) result = n // 100 print(result)