You are given an initial 2-value array (x). You will use this to calculate a score.

If both values in (x) are numbers, the score is the sum of the two. If only one is a number, the score is that number. If neither is a number, return 'Void!'.


Once you have your score, you must return an array of arrays. Each sub array will be the same as (x) and the number of sub arrays should be equal to the score.

For example:

if (x) == ['a', 3]  you should return [['a', 3], ['a', 3], ['a', 3]].

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

Solutions:
def explode(arr):
	return [arr] * sum((v for v in arr if isinstance(v, int))) or 'Void!'


def explode(arr):
	numbers = [n for n in arr if type(n) == int]
	return [arr] * sum(numbers) if numbers else 'Void!'


def explode(arr):
	(a, b, c) = (arr[0], arr[1], 0)
	if type(a) == int:
		c += a
	if type(b) == int:
		c += b
	if c == 0:
		return 'Void!'
	return [arr] * c


def explode(arr):
	return [arr] * sum((x for x in arr if type(x) == int)) or 'Void!'


explode = lambda a: [a] * sum((e for e in a if type(e) == int)) or 'Void!'


def explode(arr):
	if type(arr[0]) != int and type(arr[1]) != int:
		return 'Void!'
	elif type(arr[0]) == int and type(arr[1]) != int:
		return [arr] * arr[0]
	elif type(arr[0]) != int and type(arr[1]) == int:
		return [arr] * arr[1]
	else:
		return [arr] * sum(arr)


def explode(arr):
	num = sum([i for i in arr if type(i) == int])
	return 'Void!' if not num else [arr for i in range(num)]


def explode(arr):
	score = 0
	if isinstance(arr[0], int):
		score += arr[0]
	if isinstance(arr[1], int):
		score += arr[1]
	if score == 0:
		return 'Void!'
	return list([arr] * score)


def explode(arr):
	l = sum((type(v) == int for v in arr))
	if not l:
		return 'Void!'
	return [arr] * sum((v for v in arr if type(v) == int))