diff --git a/letter_digit.py b/letter_digit.py index e69de29..6706fe0 100644 --- a/letter_digit.py +++ b/letter_digit.py @@ -0,0 +1,22 @@ +# Calculate the number of letters and digits\pair_len = int(raw_input("Len of pair: ")) +str_eg = 'world234' + +def letterAndDigit(stri): + str_eg2 = list(stri) + dig = 0 + letter = 0 + for e in str_eg2: + if (e.isdigit() == True): + dig = dig + 1 + elif (e.isalpha() == True): + letter = letter + 1 + else: + continue + x = [dig, letter] + ans = {} + ans["DIGITS"] = dig + ans["LETTERS"] = letter + print (ans) + return ans + +letterAndDigit(str_eg) diff --git a/letter_digit.pyc b/letter_digit.pyc new file mode 100644 index 0000000..b7c49b5 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..b205e51 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..e4b51e0 Binary files /dev/null and b/tests/test_letterAndDigit.pyc differ