python program to count the number of digits in following way as given in description

write a python program to count the number of digits given as input.
for example,
if i give input as “1 2 3 4 5 6” output will be “6”
and when i give input as"1 2 3 4 5 6 7 8 9 10" then the output returned should be like,“1 to 9 it is 9 digits.10 has 2 digits 1 and 0 so the total number of digits is 9+2=11”

try and solve the question as soon as possible.

>>> data = “1 2 3 4 5 6”
>>> data1 = “1 2 3 4 5 6 7 8 9 10”
>>> sum(map(lambda x: x in ‘0123456789’, data))
6
>>> sum(map(lambda x: x in ‘0123456789’, data1))
11

1 Like