← Back to challenges

How Many Digits?

PythonHardalgorithmsmathconditionsloops

Instructions

Given an integer n. Your task is to find how many digits this integer contains without using str or len methods!

Examples

sum_digits(100) ➞ 3

sum_digits(1000) ➞ 4

sum_digits(1) ➞ 1

Notes

N/A

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