Bob is a lazy man. 

He needs you to create a method that can determine how many ```letters``` and ```digits``` are in a given string.



Example:

"hel2!lo" --> 6

"wicked .. !" --> 6

"!?..A" --> 1

Difficulty: introductory

Starter code:

def count_letters_and_digits(s):
	

Solutions:
def count_letters_and_digits(s):
    return isinstance(s, str) and sum(map(str.isalnum, s))

def count_letters_and_digits(s):
    return sum(map(str.isalnum, s))

import re
def count_letters_and_digits(s):
    if s == None or s == []:
        return 0
    return len(re.findall("[A-Za-z0-9]",s))

def count_letters_and_digits(s):
    count = 0
    for x in s:
        if x.isalpha() or x.isnumeric():
            count += 1
    return count

import re
def count_letters_and_digits(s):
    try:
        list = re.findall('[A-Za-z0-9]',s)
        return (len(list))
    except:
        return 0

def count_letters_and_digits(s):
    numerics = 0
    letters = 0
    other = 0
    for i in s:
        if i.isnumeric():
            numerics += 1
        elif i.isalpha():
            letters += 1
        else:
            other += 1
    return numerics + letters

def count_letters_and_digits(s):
    return len([item for item in s if item.isalpha() or item.isdigit()])

def count_letters_and_digits(s):
    return bool(s) and sum(map(str.isalnum, s))

import re
def count_letters_and_digits(s):
    return len(re.sub(r'[\W_]', '', s))


import re

def count_letters_and_digits(s):
    s = re.sub(r'[^\w]', '', s)
    s = s.replace('_', '')
    return len(s)