diff --git a/letter_digit.py b/letter_digit.py index e69de29..7089556 100644 --- a/letter_digit.py +++ b/letter_digit.py @@ -0,0 +1,15 @@ +strng = 'world! 234' # string argument +def letterAndDigit(str1): + assert isinstance(str1,str),'input variable should be a string' + diglist = [] + alplist = [] + for c in list(str1): + if c.isdigit(): + diglist.append(c) + elif c.isalpha(): + alplist.append(c) + countdig = len(diglist) + countchr = len(alplist) + return {'DIGITS':countdig, 'LETTERS':countchr} + +letterAndDigit(strng) diff --git a/letter_digit.pyc b/letter_digit.pyc new file mode 100644 index 0000000..10a670d 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..3b695ab 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..3177b34 Binary files /dev/null and b/tests/test_letterAndDigit.pyc differ