Rectangle Area
Programming Basics · Python
TASK
Problem
Given rectangle sides `a` and `b`, print the area.
EXAMPLE
Example
6 8
48
LIMITS
Constraints
a > 0; b > 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 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 `a * b` shows how this idea is applied to the task data.
For this task, pay special attention to `map(int, input().split())`: it connects the concept above to the concrete computation or program action.
**Focus: “Rectangle Area”.** 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
+
['Area is `a * b`.']
ANSWER
Solution
+
width, height = map(int, input().split()) area = width * height print(area)