Skip to content

Commit a1d9e87

Browse files
author
hajimalung.baba
committed
adding solution for Question 13
1 parent cb5f3bf commit a1d9e87

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Status/Day 3.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,20 @@ for item in sen:
367367
digit += 1
368368
print(f"LETTERS : {alp} \n DIGITS : {digit}")
369369
```
370+
```python
371+
'''Solution by: hajimalung
372+
'''
373+
#using reduce for to count
374+
from functools import reduce
375+
376+
def count_letters_digits(counters,char_to_check):
377+
counters[0] += char_to_check.isalpha()
378+
counters[1] += char_to_check.isnumeric()
379+
return counters
380+
381+
print('LETTERS {0}\nDIGITS {1}'.format(*reduce(count_letters_digits,input(),[0,0])))
382+
```
383+
370384
---
371385

372386
## Conclusion

0 commit comments

Comments
 (0)