← Back to challenges

Express Number in Expanded Notation

PythonHardmathalgorithmsstringsnumbers

Instructions

Create a function that takes a number and return a string with the number in expanded notation (AKA expanded form).

Examples

expand(13) ➞ "10 + 3"

expand(86) ➞ "80 + 6"

expand(17000000) ➞ "10000000 + 7000000"

expand(5325) ➞ "5000 + 300 + 20 + 5"

Notes

You can expect only whole numbers greater than 0 as test input.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.