Among the ruins of an ancient city a group of archaeologists found a mysterious function with lots of HOLES in it called ```getNum(n)``` (or `get_num(n)` in ruby, python, or r). They tried to call it with some arguments. And finally they got this journal:
The archaeologists were totally stuck with this challenge. They were all in desperation but then.... came YOU the SUPER-AWESOME programmer. Will you be able to understand the mystery of this function and rewrite it?

Source: codewars | Difficulty: EASY
Tags: Ad-hoc

Starter code: def get_num(n):
	

Solutions:
def get_num(n):
	return sum(({'0': 1, '6': 1, '9': 1, '8': 2}.get(d, 0) for d in str(n)))


get_num = lambda n: sum((int('1000001021'[int(d)]) for d in str(n)))


def get_num(n):
	return sum((str(n).count(i) for i in '06889'))


get_num = lambda n: sum(([0, [1, 2][i == '8']][i in '0689'] for i in str(n)))


holes = {'0': 1, '6': 1, '8': 2, '9': 1}

def get_num(n):
	return sum((holes.get(c, 0) for c in str(n)))


def get_num(n):
	holes = {'0': 1, '6': 1, '8': 2, '9': 1}
	return sum((holes[d] if d in holes else 0 for d in str(n)))


get_num = lambda n: sum(((d in '0689') + (d == '8') for d in str(n)))


def get_num(n):
	n = str(n).replace('8', '00').replace('9', '0').replace('6', '0')
	return n.count('0')


def get_num(n):
	holes = 0
	for val in str(n):
		if val in '069':
			holes += 1
		if val == '8':
			holes += 2
	return holes