Find the sum of the odd numbers within an array, after cubing the initial integers. The function should return `undefined`/`None`/`nil`/`NULL` if any of the values aren't numbers. 

~~~if:java,csharp
Note: There are ONLY integers in the JAVA and C# versions of this Kata.
~~~

~~~if:python
Note: Booleans should not be considered as numbers.
~~~

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def cube_odd(arr):
	

Solutions:
def cube_odd(arr):
	return sum((n ** 3 for n in arr if n % 2)) if all((type(n) == int for n in arr)) else None


def cube_odd(arr):
	if any((type(x) is not int for x in arr)):
		return None
	return sum((x ** 3 for x in arr if x % 2 != 0))


def cube_odd(arr):
	if len(set(map(type, arr))) < 2:
		return sum((n ** 3 for n in arr if n % 2))


def cube_odd(arr):
	s = 0
	for n in arr:
		if type(n) != int:
			break
		elif n % 2:
			s += n ** 3
	else:
		return s


def cube_odd(a):
	return sum((e ** 3 for e in a if e % 2)) if all((type(e) == int for e in a)) else None


def cube_odd(arr):
	if arr == [x for x in arr if type(x) == int]:
		return sum([i ** 3 for i in arr if i % 2 == 1])


def cube_odd(arr):
	total = 0
	for el in arr:
		if isinstance(el, int):
			if el % 2 == 1 and el != 0:
				total += el ** 3
		else:
			return None
	if total == 2:
		return None
	return total


def cube_odd(arr):
	ar = sum([el ** 3 for el in arr if type(el) == int and el % 2 != 0])
	return ar if [el for el in arr if type(el) != int] == [] else None


def cube_odd(arr):
	result = 0
	for n in arr:
		if type(n) == type('s') or type(n) == type(True):
			return None
		elif n ** 3 % 2 != 0 and type(n) == type(5):
			result += n ** 3
	return result


def cube_odd(n):
	return sum([el ** 3 for el in n if type(el) == int and el % 2 != 0]) if [el for el in n if type(el) != int] == [] else None


def cube_odd(arr):
	odds = []
	for num in arr:
		if type(num) != type(4):
			return None
		elif num % 2 != 0:
			odds.append(num ** 3)
	return sum(odds)


def cube_odd(arr):
	n = 0
	for i in arr:
		if type(i) != int:
			return None
			break
		elif i % 2 != 0 or -1 * i % 2 != 0:
			n += i ** 3
	return n


def cube_odd(arr):
	if len([el for el in arr if type(el) != int]) > 0:
		return None
	return sum([el ** 3 for el in arr if el % 2 != 0])


def cube_odd(a):
	(sum, i) = (0, 0)
	while True:
		try:
			if type(a[i]) != int:
				return None
			if a[i] & 1:
				sum += a[i] ** 3
		except IndexError:
			break
		i += 1
	return sum


def cube_odd(arr):
	cube = []
	for i in arr:
		if type(i) != int:
			return None
		if i % 2 != 0:
			cube.append(i ** 3)
	return sum(cube)


def cube_odd(arr):
	new_arr = []
	for el in arr:
		if type(el) != int:
			return None
		elif el % 2 != 0 and type(el) == int:
			new_arr.append(el ** 3)
	return sum(new_arr)


def cube_odd(arr):
	s = 0
	if any((isinstance(b, bool) for b in arr)):
		return None
	if not all((isinstance(x, int) for x in arr)):
		return None
	for i in range(0, len(arr)):
		if arr[i] % 2 != 0:
			s += arr[i] ** 3
	return s


def cube_odd(arr):
	sum = 0
	for i in range(len(arr)):
		if type(arr[i]) != int:
			return None
		if arr[i] % 2 == 1:
			sum += arr[i] ** 3
	return sum


def cube_odd(arr):
	x = 0
	for i in arr:
		if type(i) is not int:
			return None
		if i % 2 != 0:
			x += i * i * i
	return x


def cube_odd(a):
	total = 0
	try:
		for i in a:
			if str(i) is 'False' or str(i) is 'True':
				return None
			total += i ** 3 if i ** 3 % 2 != 0 else 0
		return total
	except:
		return None


def cube_odd(arr):
	for item in arr:
		if type(item) != int:
			return
	return sum((i ** 3 for i in arr if i % 2 != 0))


def cube_odd(arr):
	while all((type(d) == int for d in arr)):
		return sum((d ** 3 for d in arr if d ** 3 % 2 == 1))


def cube_odd(arr):
	res = 0
	for i in arr:
		if type(i) != int:
			return None
		if i % 2:
			res += i ** 3
	return res


def cube_odd(arr):
	a = [i for i in arr if type(i) == int]
	return sum([i ** 3 for i in a if i % 2 == 1]) if len(a) == len(arr) else None


def cube_odd(arr):
	for i in arr:
		if type(i) != int:
			return None
	return sum([i ** 3 for i in arr if i % 2])


def cube_odd(arr):
	o = 0
	for i in arr:
		if type(i) != int:
			return None
		elif i % 2 == 1:
			o += i ** 3
		else:
			continue
	return o


def cube_odd(arr):
	s = 0
	for x in arr:
		if type(x) != int:
			return None
		elif x ** 3 % 2 == 1:
			s += x ** 3
	return s


def cube_odd(arr):
	odd = list()
	for i in arr:
		if isinstance(i, int) and (not isinstance(i, bool)):
			if abs(i) % 2 != 0:
				odd.append(i)
		else:
			return None
	return sum(map(lambda x: x ** 3, odd))


def cube_odd(arr):
	res = 0
	for n in arr:
		if type(n) != int:
			return None
		res += n ** 3 if n % 2 else 0
	return res


def cube_odd(arr):
	a = 0
	for i in arr:
		if type(i) != int:
			break
		elif i % 2 != 0:
			a += i ** 3
	else:
		return a


def cube_odd(x):
	if len(x) != len([i for i in x if type(i) == int]):
		return None
	else:
		return sum([i ** 3 for i in x if i % 2 != 0])


def cube_odd(arr):
	result = 0
	for el in arr:
		if type(el) != int:
			return None
		if el % 2 != 0:
			result += el * el * el
	return result


def cube_odd(arr):
	c = []
	n = []
	for x in arr:
		if type(x) != int:
			return None
		elif x < 0 and x % 2 != 0:
			c.append(x ** 3)
		elif x > 0 and x % 2:
			n.append(x ** 3)
	return sum(n) + sum(c)


def cube_odd(arr):
	l = []
	for x in arr:
		if type(x) != int:
			return None
		elif x % 2 == 1:
			l.append(x ** 3)
	return sum(l)


def cube_odd(arr):
	func = lambda x: isinstance(x, (int, float)) and (not isinstance(x, bool))
	return (all(map(func, arr)) or None) and sum((x ** 3 for x in arr if x ** 3 % 2))


def cube_odd(arr):
	x = [i for i in arr if not isinstance(i, bool)]
	if len(x) == len(arr):
		try:
			return sum([i ** 3 for i in x if i % 2])
		except:
			pass


def cube_odd(arr):
	int_arr = []
	for i in arr:
		if type(i) == int:
			int_arr.append(i)
		else:
			return None
	res = []
	for i in int_arr:
		if i % 2 != 0:
			res.append(i)
	res2 = []
	for i in res:
		res2.append(i * i * i)
	return sum(res2)


def cube_odd(arr):
	x = 0
	for i in arr:
		if type(i) is not int:
			return None
			break
		elif i % 2 != 0:
			x += i ** 3
	return x


def cube_odd(A):
	print(A)
	r = None
	for i in A:
		if not isinstance(i, int) or isinstance(i, bool):
			return None
		if i % 2:
			r = i ** 3 if not r else r + i ** 3
	return r


def cube_odd(arr):
	new_arr = []
	for i in range(len(arr)):
		if type(arr[i]) == bool:
			return None
		if type(arr[i]) == str:
			return None
		new_arr.append(arr[i] ** 3)
	value = 0
	for i in range(len(new_arr)):
		if new_arr[i] % 2 == 1:
			value += new_arr[i]
	return value


def cube_odd(arr):
	res = 0
	for i in arr:
		if not isinstance(i, int) or isinstance(i, bool):
			return None
		elif i % 2 != 0:
			res += i ** 3
	return res


def cube_odd(arr):
	all_int = all((type(n) == int for n in arr))
	return sum((n ** 3 for n in arr if n & 1)) if all_int else None


def cube_odd(arr):
	res = 0
	for i in arr:
		if isinstance(i, int) and (not isinstance(i, bool)):
			if i ** 3 % 2 == 1:
				res += i ** 3
		else:
			return None
	return res


def cube_odd(arr):
	accumulator = 0
	for eachvalue in arr:
		if type(eachvalue) != type(1):
			return None
		elif eachvalue % 2 != 0:
			x = eachvalue ** 3
			accumulator = accumulator + x
	return accumulator


def cube_odd(arr):
	res_arr = [x for x in arr if isinstance(x, int) and (not isinstance(x, bool))]
	if len(res_arr) == len(arr):
		return sum([x ** 3 for x in arr if x % 2 != 0])
	else:
		return None


def cube_odd(arr):
	if any((str(char).isalpha() for char in arr)) == True:
		return None
	return sum((char ** 3 for char in arr if char % 2 != 0))


import unittest

def cube_odd(arr):

	def _is_none_condition():
		return any((True if not isinstance(ele, int) or ele is True or ele is False else False for ele in arr))
	if _is_none_condition():
		return
	return sum((ele ** 3 if ele % 2 == 1 else 0 for ele in arr))

class TestCubeOdd(unittest.TestCase):

	def test_should_return_none_when_any_of_the_values_are_not_numbers(self):
		arr = ['a', 12, 9, 'z', 42]
		actual = cube_odd(arr)
		self.assertEqual(actual, None)

	def test_cube_odd(self):
		arr = [1, 2, 3, 4]
		actual = cube_odd(arr)
		self.assertEqual(actual, 28)


def cube_odd(arr):
	s = 0
	for i in arr:
		if type(i) == bool or type(i) == str:
			return None
		elif i % 2 == 1:
			s += i ** 3
	return s


def cube_odd(arr):
	output = 0
	for i in arr:
		if type(i) == int:
			if i % 2 != 0:
				output += i ** 3
		else:
			return None
	return output


def cube_odd(arr):
	_arr = [n for n in arr if type(n) == int]
	if len(_arr) != len(arr):
		return None
	arr = [n ** 3 for n in arr if n % 2 != 0]
	return 0 if not arr else sum(arr)


def cube_odd(arr):
	if all((type(x) is int or type(x) is float for x in arr)):
		return sum((x ** 3 for x in arr if x % 2))


def cube_odd(arr):
	cubes = []
	for item in arr:
		if str(item).strip('-').isdigit() == False:
			return None
		elif item % 2 != 0:
			cubes.append(item ** 3)
	return sum(cubes)


def cube_odd(arr):
	if all((type(i) == int for i in arr)):
		return sum((i ** 3 for i in arr if i % 2 != 0))
	else:
		return None


def cube_odd(arr):
	return sum((x ** 3 for x in arr if x % 2 == 1)) if all((type(x) is int for x in arr)) else None


def cube_odd(arr):
	sum = 0
	for x in arr:
		if not isinstance(x, (int, float, complex)) or isinstance(x, bool):
			return None
		if x % 2 == 1:
			sum += x ** 3
	return sum


def cube_odd(arr):
	if any((isinstance(v, bool) or not isinstance(v, int) for v in arr)):
		return
	return sum((v ** 3 for v in arr if v % 2))


def cube_odd(arr):
	sum = 0
	for x in arr:
		if type(x) == int:
			if x % 2 == 1:
				sum += x ** 3
		else:
			return None
	return sum


def cube_odd(arr):
	res = []
	for i in arr:
		if not type(i) == int:
			return None
		if i % 2:
			res.append(i ** 3)
	return sum(res)


def cube_odd(n):
	sum = 0
	for n in n:
		if type(n) != int:
			return None
		if n % 2 != 0:
			sum += n ** 3
	return sum


def cube_odd(arr):
	total = 0
	for elem in arr:
		if type(elem) == int:
			if elem % 2 == 1:
				total += elem ** 3
		else:
			return None
	return total


def cube_odd(arr):
	result = 0
	for i in arr:
		if not isinstance(i, int) or isinstance(i, bool):
			return None
		result += i ** 3 if i & 1 else 0
	return result


def cube_odd(arr):
	cubed = []
	for i in arr:
		if type(i) != int:
			return None
		else:
			cubed.append(i ** 3)
	new_arr = []
	for x in cubed:
		if x % 2 != 0:
			new_arr.append(x)
	return sum(new_arr)


def cube_odd(arr):
	if set(map(type, arr)) != {int}:
		return None
	return sum([y for y in [x ** 3 for x in arr] if y % 2 == 1])


def cube_odd(arr):
	return sum((x ** 3 for x in arr if x % 2)) if all((isinstance(x, int) and (not isinstance(x, bool)) for x in arr)) else None


def cube_odd(arr):
	try:
		return sum(['x' if type(i) == bool else i ** 3 for i in arr if i ** 3 % 2 != 0])
	except:
		return None


def cube_odd(arr):
	s = 0
	for i in arr:
		if type(i) is int:
			if i % 2 != 0:
				s += i ** 3
		else:
			return None
	return s


def cube_odd(arr):
	if all(map(lambda x: type(x) is int, arr)):
		return sum(map(lambda x: x ** 3, filter(lambda x: x % 2, arr)))
	return None


def cube_odd(arr):
	for x in arr:
		if type(x) is not int:
			return None
	cube = [x ** 3 for x in arr]
	r = 0
	for x in cube:
		if x % 2 != 0:
			r += x
	return r


def cube_odd(arr):
	return None if any([type(i) != int for i in arr]) else sum((i ** 3 for i in arr if i % 2 == 1))


cube_odd = lambda lst: None if not all((type(x) is int for x in lst)) else sum((n ** 3 for n in lst if n & 1))


def cube_odd(arr):
	try:
		sum = 0
		for i in range(len(arr)):
			if i >= len(arr):
				break
			else:
				a = i
				if str(arr[a]) in ['True', 'False']:
					return None
				elif arr[a] % 2 == 1:
					sum += arr[a] ** 3
		return sum
	except TypeError:
		return None


def cube_odd(arr):
	r = 0
	for a in arr:
		if type(a) != int:
			return None
		if a % 2 != 0:
			r += a ** 3
	return r


def cube_odd(arr):
	arr1 = []
	result = 0
	try:
		for i in arr:
			if type(i) == bool:
				return None
			elif i % 2 != 0:
				result = i ** 3
				arr1.append(result)
		return sum(arr1)
	except TypeError:
		return None


def cube_odd(arr):
	arr_cubed = []
	sum = 0
	for element in arr:
		if not str(element).isdigit() and (not str(element)[0] == '-'):
			return None
		else:
			arr_cubed.append(element ** 3)
	for element in arr_cubed:
		if not element % 2 == 0:
			sum += element
	return sum


def cube_odd(arr):
	s = 0
	arr1 = []
	for i in arr:
		if type(i) == str or type(i) == bool:
			return None
			break
		else:
			arr1.append(i)
	for i in range(len(arr1)):
		if arr1[i] % 2 == 1:
			s += arr1[i] ** 3
	return s