Scott
0
Q:

number of digits in a number python

n = 1234 //Any Random Number
digits = len(str(n)) //Saves the number of digits of n into the variable digits
2
import math
digits = int(math.log10(n))+1
2

New to Communities?

Join the community