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

**URL:** <https://forums.digi.com/t/python-program-to-count-the-number-of-digits-in-following-way-as-given-in-description/17765>\
**Category:** Python\
**Tags:** api\
**Created:** [December 2, 2016, 8:45am UTC](https://forums.digi.com/t/python-program-to-count-the-number-of-digits-in-following-way-as-given-in-description/17765 "2016-12-02T08:45:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SAP\_PYTHON](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@SAP\_PYTHON](https://forums.digi.com/u/SAP_PYTHON)\
**Post date:** [December 2, 2016, 8:45am UTC](https://forums.digi.com/t/python-program-to-count-the-number-of-digits-in-following-way-as-given-in-description/17765/1 "2016-12-02T08:45:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![NicholasWilson](https://avatars.discourse-cdn.com/v4/letter/n/c77e96/32.png) [@NicholasWilson](https://forums.digi.com/u/NicholasWilson)\
**Post date:** [December 5, 2016, 2:20am UTC](https://forums.digi.com/t/python-program-to-count-the-number-of-digits-in-following-way-as-given-in-description/17765/2 "2016-12-05T02:20:31Z")

</div>

\>\>\> 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
