In order to count digits of a number I write this code in python:
a=int(input('number: '))
count=0
while a!=0:
a=a//10
count=count+1
print('number has ',count,'digits')
It works well for inputs like 13,1900,3222,....
But It give an error for numbers like: 3^21, 2^3,3*4,...
It say:
ValueError: invalid literal for int() with base 10: '3**21'
3**21 is integer input So why it gives this erroer,and How Should I fix this?