Circumference
Programming Basics · Python
TASK
Problem
Given radius `r`, use π = 3.14 and print circumference `2πr`.
EXAMPLE
Example
5
31.400000000000002
LIMITS
Constraints
Physical and monetary quantities that cannot be negative are non-negative; the absolute value of other numeric inputs is at most 10^9.
LEARN
Theory for this problem
+
`input()` reads data entered by the user. The result of `input()` is initially a string. `float()` converts a numeric string into a number that may contain a decimal part. 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 `2 * 3.14 * r` shows how this idea is applied to the task data.
NEED HELP?
Hints
+
['Circumference formula: `2 * 3.14 * r`.']
ANSWER
Solution
+
r = float(input()) result = 2 * 3.14 * r print(result)