Base on the fairy tale [Diamonds and Toads](https://en.wikipedia.org/wiki/Diamonds_and_Toads) from Charles Perrault. In this kata you will have to complete a function that take 2 arguments: 

- A string, that correspond to what the daugther says.
- A string, that tell you wich fairy the girl have met, this one can be `good` or `evil`. 

The function should return the following count as a hash:

- If the girl have met the `good` fairy:
  - count 1 `ruby` everytime you see a `r` and 2 everytime you see a `R`
  - count 1 `crystal` everytime you see a `c` and 2 everytime you see a `C`
- If the girl have met the `evil` fairy: 
  - count 1 `python` everytime you see a `p` and 2 everytime uou see a `P`
  - count 1 `squirrel` everytime you see a `s` and 2 everytime you see a `S`
  
**Note**: For this kata I decided to remplace the normal `Diamonds` and `Toads` by some programming languages. And just discover that [Squirrel](https://en.wikipedia.org/wiki/Squirrel_(programming_language) is a programming language.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def diamonds_and_toads(sentence,fairy):
	

Solutions:
from collections import Counter

def diamonds_and_toads(sentence, fairy):
	c = Counter(sentence)
	d = {'good': ['ruby', 'crystal'], 'evil': ['python', 'squirrel']}
	return {s: c[s[0]] + 2 * c[s[0].upper()] for s in d[fairy]}


def diamonds_and_toads(sentence, fairy):
	items = {'ruby': 0, 'crystal': 0} if fairy == 'good' else {'python': 0, 'squirrel': 0}
	for key in items.keys():
		items[key] = sentence.count(key[0]) + 2 * sentence.count(key[0].upper())
	return items


def diamonds_and_toads(sentence, fairy):
	res = {}
	if fairy == 'good':
		res['ruby'] = sentence.count('r') + sentence.count('R') * 2
		res['crystal'] = sentence.count('c') + sentence.count('C') * 2
	elif fairy == 'evil':
		res['python'] = sentence.count('p') + sentence.count('P') * 2
		res['squirrel'] = sentence.count('s') + sentence.count('S') * 2
	return res


def do(a, b, c, d, s):
	dc = {a: 0, b: 0}
	for i in s:
		if i in c:
			dc[[a, b][i in d]] += [1, 2][i.isupper()]
	return dc
diamonds_and_toads = lambda s, f: do(*[['ruby', 'crystal', 'rcRC', 'cC', s], ['python', 'squirrel', 'psPS', 'sS', s]][f == 'evil'])


def diamonds_and_toads(phrase, fairy):
	if fairy == 'good':
		return {'ruby': phrase.count('r') + phrase.count('R') * 2, 'crystal': phrase.count('c') + phrase.count('C') * 2}
	else:
		return {'python': phrase.count('p') + phrase.count('P') * 2, 'squirrel': phrase.count('s') + phrase.count('S') * 2}


diamonds_and_toads = lambda s, f: {'ruby': s.count('r') + s.count('R') * 2, 'crystal': s.count('c') + s.count('C') * 2} if f == 'good' else {'python': s.count('p') + s.count('P') * 2, 'squirrel': s.count('s') + s.count('S') * 2}


def diamonds_and_toads(sentence, fairy):
	jewels = ['ruby', 'crystal'] if fairy == 'good' else ['python', 'squirrel']
	return {j: sentence.count(j[0]) + 2 * sentence.count(j[0].upper()) for j in jewels}


diamonds_and_toads = lambda s, f: {k: s.count(k[0]) + 2 * s.count(k[0].upper()) for k in ['crystal', 'python', 'ruby', 'squirrel'][f < 'f'::2]}