The magic sum of 3s is calculated on an array by summing up odd numbers which include the digit `3`. Write a function `magic_sum` which accepts an array of integers and returns the sum.

*Example:* `[3, 12, 5, 8, 30, 13]` results in `16` (`3` + `13`)

If the sum cannot be calculated, `0` should be returned.

Difficulty: EASY
Starter code: def magic_sum(arr):
	

Solutions:
def magic_sum(arr):
	return arr and sum((x for x in arr if x % 2 and '3' in str(x))) or 0


def magic_sum(arr):
	if arr == None:
		return 0
	return sum(list(filter(lambda x: x % 2 == 1 and '3' in str(x), arr)))


def magic_sum(arr):

	def check(x):
		return x % 2 and '3' in str(x)
	return sum((x for x in arr if check(x))) if arr else 0


def magic_sum(arr):
	return sum((i for i in arr if i % 2 == 1 and '3' in str(i))) if arr else 0


def magic_sum(arr):
	return sum((n for n in arr if n % 2 and '3' in str(n))) if arr else 0


magic_sum = lambda a: sum((n % 2 * n * ('3' in str(n)) for n in a or []))


def magic_sum(arr):
	return sum((v for v in arr if '3' in set(str(v)) and v % 2)) if arr else 0


def magic_sum(arr):
	if arr == None or arr == []:
		return 0
	output = 0
	for num in arr:
		if '3' in str(num) and num % 2 == 1:
			output += num
		else:
			pass
	return output