Error Handling is very important in coding and seems to be overlooked or not implemented properly.

#Task

Your task is to implement a function which takes a string as input and return an object containing the properties
vowels and consonants. The vowels property must contain the total count of vowels {a,e,i,o,u}, and the total count of consonants {a,..,z} - {a,e,i,o,u}. Handle invalid input and don't forget to return valid ones.

#Input

The input is any random string. You must then discern what are vowels and what are consonants and sum for each category their total occurrences in an object. However you could also receive inputs that are not strings. If this happens then you must return an object with a vowels and consonants total of 0 because the input was NOT a string. Refer to the Example section for a more visual representation of which inputs you could receive and the outputs expected. :)

Example:

```python
Input: get_count('test')
Output: {vowels:1,consonants:3}

Input: get_count('tEst')
Output: {vowels:1,consonants:3}

Input get_count('    ')
Output: {vowels:0,consonants:0}

Input get_count()
Output: {vowels:0,consonants:0}
```

C#

A Counter class has been put in the preloaded section taking two parameters Vowels and Consonants this must be the Object you return!

Difficulty: EASY
Starter code: def get_count(words=''):
	

Solutions:
def get_count(words=''):
	if not isinstance(words, str):
		return {'vowels': 0, 'consonants': 0}
	letter = ''.join([c.lower() for c in words if c.isalpha()])
	vowel = ''.join([c for c in letter if c in 'aeiou'])
	consonant = ''.join([c for c in letter if c not in 'aeiou'])
	return {'vowels': len(vowel), 'consonants': len(consonant)}


def get_count(words=''):
	vowels = 'aeiou'
	consonants = 'bcdfghjklmnpqrstvwxyz'
	(v, c) = (0, 0)
	try:
		for l in words.lower():
			if l in vowels:
				v += 1
			elif l in consonants:
				c += 1
		return {'vowels': v, 'consonants': c}
	except:
		return {'vowels': 0, 'consonants': 0}


def get_count(words=None):
	ret = {'vowels': 0, 'consonants': 0}
	if words and isinstance(words, str):
		for char in words.lower():
			if char in 'aeiouy':
				ret['vowels'] += 1
			elif char.isalpha():
				ret['consonants'] += 1
	return ret


import re

def get_count(words=''):
	(vow_count, con_count) = (0, 0)
	if type(words) is str:
		(remainder, vow_count) = re.subn('[aeiou]', '', words, flags=re.I)
		(_, con_count) = re.subn('\\w', '', remainder, flags=re.I)
	return {'vowels': vow_count, 'consonants': con_count}


def get_count(words=None):
	result = {'vowels': 0, 'consonants': 0}
	(vowels, consonants) = ('aeiou', 'bcdfghjklmnpqrstvwxyz')
	if type(words) == str:
		result['vowels'] = len([v for v in words.lower() if v in vowels])
		result['consonants'] = len([c for c in words.lower() if c in consonants])
	return result


is_vowels = set('aeiou').__contains__
is_conson = set('bcdfghjklmnpqrstvwxyz').__contains__

def get_count(words=None):
	result = {'vowels': 0, 'consonants': 0}
	if words and type(words) == str:
		for c in words.lower():
			result['vowels'] += is_vowels(c)
			result['consonants'] += is_conson(c)
	return result


(V, C) = 'vowels consonants'.split()

def get_count(s=None):
	d = {V: 0, C: 0}
	if not isinstance(s, str):
		return d
	for c in s.lower():
		if c in 'aeiou':
			d[V] += 1
		elif c.isalpha():
			d[C] += 1
	return d


def get_count(s=''):
	ret = {'vowels': 0, 'consonants': 0}
	if type(s) != str:
		return ret
	for c in s.lower():
		if c in 'aeiou':
			ret['vowels'] += 1
		elif c.isalpha():
			ret['consonants'] += 1
	return ret


def get_count(words=''):
	vowels = consonants = 0
	if type(words) == str:
		for char in words.lower():
			if char.isalpha():
				vowel = char in 'aeiou'
				vowels += vowel
				consonants += not vowel
	return {'vowels': vowels, 'consonants': consonants}


def get_count(words=''):
	if not isinstance(words, str):
		words = ''
	words = words.lower()
	return {'vowels': sum((c in 'aeiou' for c in words)), 'consonants': sum((c.isalpha() and c not in 'aeiou' for c in words))}