diff --git a/letter_digit.py b/letter_digit.py index e69de29..00a3c70 100644 --- a/letter_digit.py +++ b/letter_digit.py @@ -0,0 +1,16 @@ +def letterAndDigit(s1): + dict1 = {"DIGITS":0, "LETTERS":0,'SPACE':0,"OTHER":0} + + numbers = sum(c.isdigit() for c in s1) + dict1.update({'DIGITS':numbers}) + + words = sum(c.isalpha() for c in s1) + dict1.update({'LETTERS':words}) + + spaces = sum(c.isspace() for c in s1) + dict1.update({'SPACE':spaces}) + + others = len(s1) - numbers - words - spaces + dict1.update({'OTHER':others}) + + return dict1 diff --git a/letter_digit.pyc b/letter_digit.pyc new file mode 100644 index 0000000..b3a0e21 Binary files /dev/null and b/letter_digit.pyc differ diff --git a/tests/__init__.pyc b/tests/__init__.pyc new file mode 100644 index 0000000..1655bf0 Binary files /dev/null and b/tests/__init__.pyc differ diff --git a/tests/test_letterAndDigit.pyc b/tests/test_letterAndDigit.pyc new file mode 100644 index 0000000..046e77f Binary files /dev/null and b/tests/test_letterAndDigit.pyc differ