For this problem you must create a program that says who ate the last cookie. If the input is a string then "Zach" ate the cookie. If the input is a float or an int then "Monica" ate the cookie. If the input is anything else "the dog" ate the cookie. The way to return the statement is:
"Who ate the last cookie? It was (name)!"

Ex: Input = "hi" --> Output = "Who ate the last cookie? It was Zach!
(The reason you return Zach is because the input is a string)

Note: Make sure you return the correct message with correct spaces and punctuation.

Please leave feedback for this kata.
Cheers!

Difficulty: EASY
Starter code: def cookie(x):
	

Solutions:
def cookie(x):
	return 'Who ate the last cookie? It was %s!' % {str: 'Zach', float: 'Monica', int: 'Monica'}.get(type(x), 'the dog')


def cookie(x):
	try:
		who = {int: 'Monica', float: 'Monica', str: 'Zach'}[type(x)]
	except KeyError:
		who = 'the dog'
	return 'Who ate the last cookie? It was %s!' % who


def cookie(x):
	if type(x) == type('x'):
		name = 'Zach'
	elif type(x) == type(42) or type(x) == type(3.14):
		name = 'Monica'
	else:
		name = 'the dog'
	return 'Who ate the last cookie? It was %s!' % name


def cookie(x):
	return f"Who ate the last cookie? It was {('Zach' if type(x) is str else 'Monica' if type(x) in [int, float] else 'the dog')}!"


def cookie(x):
	return f"Who ate the last cookie? It was {('the dog' if isinstance(x, bool) else 'Zach' if isinstance(x, str) else 'Monica')}!"


def cookie(x):
	result = ''
	if isinstance(x, str):
		result = 'Who ate the last cookie? It was Zach!'
	elif isinstance(x, float) and type(x) is not bool:
		result = 'Who ate the last cookie? It was Monica!'
	elif isinstance(x, int) and type(x) is not bool:
		result = 'Who ate the last cookie? It was Monica!'
	else:
		result = 'Who ate the last cookie? It was the dog!'
	return result


def cookie(x):
	pre = 'Who ate the last cookie? It was '
	post = 'the dog'
	punc = '!'
	if type(x) == str:
		post = 'Zach'
	elif type(x) == int or type(x) == float:
		post = 'Monica'
	return pre + post + punc


def cookie(x):
	types = {'str': 'Zach', 'int': 'Monica', 'float': 'Monica'}
	return 'Who ate the last cookie? It was {0}!'.format(types.get(type(x).__name__, 'the dog'))


d = {'str': 'Zach', 'int': 'Monica', 'float': 'Monica'}

def cookie(x):
	return f"Who ate the last cookie? It was {d.get(type(x).__name__, 'the dog')}!"


def cookie(x):
	if isinstance(x, str):
		return 'Who ate the last cookie? It was Zach!'
	elif isinstance(x, bool):
		return 'Who ate the last cookie? It was the dog!'
	elif isinstance(x, (float, int)):
		return 'Who ate the last cookie? It was Monica!'
	else:
		return 'Who ate the last cookie? It was the dog!'


def cookie(x):
	if type(x) == str:
		x = 'Zach'
	elif type(x) == int or type(x) == float:
		x = 'Monica'
	else:
		x = 'the dog'
	return f'Who ate the last cookie? It was {x}!'


def cookie(x):
	if type(x) is str:
		return 'Who ate the last cookie? It was Zach!'
	elif type(x) is bool:
		return 'Who ate the last cookie? It was the dog!'
	return 'Who ate the last cookie? It was Monica!'


def cookie(x):
	name = {isinstance(x, y): z for (z, y) in dict(Zach=str, Monica=(int, float), _dog=bool).items()}.get(1, '_dog').replace('_', 'the ')
	return f'Who ate the last cookie? It was {name}!'


def cookie(x):
	name = dict(zip((isinstance(x, t) for t in (str, (int, float), bool)), ('Zach', 'Monica', 'the dog'))).get(1, 'the dog')
	return f'Who ate the last cookie? It was {name}!'


def cookie(x):
	name = 'Zach' if isinstance(x, str) else 'Monica' if (isinstance(x, float) or isinstance(x, int)) and (not isinstance(x, bool)) else 'the dog'
	return f'Who ate the last cookie? It was {name}!'


from typing import Any

def cookie(x: Any) -> str:
	cookie_eaters = {type(x) is str: 'Zach', type(x) in (float, int): 'Monica'}
	return f"Who ate the last cookie? It was {cookie_eaters.get(True, 'the dog')}!"


def cookie(x):
	who = 'the dog'
	if isinstance(x, str):
		who = 'Zach'
	elif isinstance(x, float) or isinstance(x, int):
		who = 'Monica'
	if isinstance(x, bool):
		who = 'the dog'
	return f'Who ate the last cookie? It was {who}!'


def cookie(x):
	print(x)
	if type(x) is str:
		return 'Who ate the last cookie? It was Zach!'
	elif type(x) is bool:
		return 'Who ate the last cookie? It was the dog!'
	elif type(x) is float or int:
		return 'Who ate the last cookie? It was Monica!'
	else:
		return 'Who ate the last cookie? It was the dog!'


def cookie(x):
	name = 'Monica' if type(x) == int or type(x) == float else 'the dog' if type(x) == bool else 'Zach'
	return 'Who ate the last cookie? It was {}!'.format(name)


def cookie(x):
	name = {'str': 'Zach', 'int': 'Monica', 'float': 'Monica', 'bool': 'the dog'}[type(x).__name__]
	return f'Who ate the last cookie? It was {name}!'


def cookie(x):
	if isinstance(x, str):
		name = 'Zach'
	elif not isinstance(x, (float, int)) or x in [True, False]:
		name = 'the dog'
	else:
		name = 'Monica'
	return f'Who ate the last cookie? It was {name}!'


def cookie(x):
	ergebnis = ''
	if type(x) == str:
		ergebnis = 'Who ate the last cookie? It was Zach!'
	elif type(x) in (int, float):
		ergebnis = 'Who ate the last cookie? It was Monica!'
	else:
		ergebnis = 'Who ate the last cookie? It was the dog!'
	return ergebnis


def cookie(x):
	if isinstance(x, bool):
		name = 'the dog'
	elif isinstance(x, str):
		name = 'Zach'
	else:
		name = 'Monica'
	return 'Who ate the last cookie? It was {}!'.format(name)


def cookie(x):
	tp = str(type(x))
	if tp == "<class 'str'>":
		return f'Who ate the last cookie? It was Zach!'
	elif tp == "<class 'float'>" or tp == "<class 'int'>":
		return f'Who ate the last cookie? It was Monica!'
	elif tp == "<class 'bool'>":
		return f'Who ate the last cookie? It was the dog!'


def cookie(x):
	if type(x) == type('Ryan'):
		return 'Who ate the last cookie? It was Zach!'
	elif type(x) == type(1.2) or type(x) == type(1):
		return 'Who ate the last cookie? It was Monica!'
	else:
		return 'Who ate the last cookie? It was the dog!'


def cookie(x):
	eaters = {str: 'Zach', float: 'Monica', int: 'Monica'}
	try:
		return 'Who ate the last cookie? It was {}!'.format(eaters[type(x)])
	except:
		return 'Who ate the last cookie? It was the dog!'


def cookie(x):
	d = {type(x) == str: 'Zach', type(x) == int or type(x) == float: 'Monica', type(x) == bool: 'the dog'}
	return f'Who ate the last cookie? It was {d.get(1)}!'


def cookie(x):
	culprit = ''
	if isinstance(x, str):
		culprit = 'Zach'
	elif isinstance(x, float):
		culprit = 'Monica'
	elif x == 26:
		culprit = 'Monica'
	else:
		culprit = 'the dog'
	return f'Who ate the last cookie? It was {culprit}!'


def cookie(x):
	return 'Who ate the last cookie? It was %s!' % ('Zach' if isinstance(x, str) else 'Monica' if type(x) == int or isinstance(x, float) else 'the dog')


def cookie(x):
	z = 'Zach'
	m = 'Monica'
	d = 'the dog'
	if isinstance(x, str):
		return f'Who ate the last cookie? It was {z}!'
	elif isinstance(x, bool):
		return f'Who ate the last cookie? It was {d}!'
	elif isinstance(x, int) or isinstance(x, float):
		return f'Who ate the last cookie? It was {m}!'
	else:
		return f'Who ate the last cookie? It was {d}!'


def cookie(x):
	name = ''
	if isinstance(x, str):
		name = 'Zach'
	elif isinstance(x, (float, int)) and type(x) is int or type(x) is float:
		name = 'Monica'
	else:
		name = 'the dog'
	return 'Who ate the last cookie? It was {}!'.format(name)


def cookie(x):
	name = 'Zach' if type(x) == str else 'Monica' if type(x) in (int, float) else 'the dog'
	return 'Who ate the last cookie? It was {}!'.format(name)


def cookie(x):
	if type(x) == str:
		return 'Who ate the last cookie? It was Zach!'
	elif type(x) == float:
		return 'Who ate the last cookie? It was Monica!'
	elif type(x) == int:
		return 'Who ate the last cookie? It was Monica!'
	else:
		return 'Who ate the last cookie? It was the dog!'
cookie(2.5)


def cookie(x):
	WHOATETHECOOKIE = ''
	if x == str(x):
		WHOATETHECOOKIE = 'Zach!'
	elif x == bool(x):
		WHOATETHECOOKIE = 'the dog!'
	else:
		WHOATETHECOOKIE = 'Monica!'
	return 'Who ate the last cookie? It was ' + WHOATETHECOOKIE


def cookie(x):
	res = isinstance(x, str)
	nu = isinstance(x, float)
	num = isinstance(x, int)
	if res == True:
		return 'Who ate the last cookie? It was Zach!'
	elif x == True or x == False:
		return 'Who ate the last cookie? It was the dog!'
	elif nu == True or num == True:
		return 'Who ate the last cookie? It was Monica!'


def cookie(x):
	if isinstance(x, str):
		return 'Who ate the last cookie? It was Zach!'
	elif str(x).replace('.', '').isdigit():
		return 'Who ate the last cookie? It was Monica!'
	else:
		return 'Who ate the last cookie? It was the dog!'


def cookie(x):
	if x == True or x == False:
		return 'Who ate the last cookie? It was the dog!'
	elif x == str(x):
		return 'Who ate the last cookie? It was Zach!'
	elif x == float(x):
		return 'Who ate the last cookie? It was Monica!'


def cookie(x):
	culprit = 'the dog'
	if type(x) == type(''):
		culprit = 'Zach'
	elif type(x) == type(1) or type(x) == type(1.1):
		culprit = 'Monica'
	return 'Who ate the last cookie? It was {0}!'.format(culprit)


def cookie(x):
	output = 'Zach' if type(x) == str else 'Monica' if type(x) == int or type(x) == float else 'the dog'
	return 'Who ate the last cookie? It was {}!'.format(output)