In recreational mathematics, a magic square is an arrangement of distinct numbers (i.e., each number is used once), usually integers, in a square grid, where the numbers in each row, and in each column, and the numbers in the main and secondary diagonals, all add up to the same number, called the "magic constant."

For example, the following "square":

      4    9    2 -> 15
      3    5    7 -> 15
      8    1    6 -> 15
     /v    v    v \
    15 15   15   15  15
    
A 3x3 magic square will have its sums always resulting to 15, this number is called the "magic constant" and changes according to the square size.

In this problem you will have to create a function that receives a 3x3 'square' and returns True if it is magic and False otherwise.
The sum of rows, columns or diagonals should **always** equal **15**.

For example, the above square will be passed like: `[4, 9, 2, 3, 5, 7, 8, 1, 6]` and the output should be True

`[9, 4, 7, 3, 5, 2, 8, 6, 1]` should return False

### Note:
This kata is very easy. If you want to try some more "difficult" ones you may try these :
* [Magic Square - Verify 3x3](https://www.codewars.com/kata/magic-square-verify-3x3)
* [Double Even Magic Square](https://www.codewars.com/kata/double-even-magic-square)
* [Odd Magic Square](https://www.codewars.com/kata/odd-magic-square)

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def is_magical(sq):
	

Solutions:
def is_magical(sq):
	return sum(sq[2:7:2]) == sum(sq[::4]) == sum(sq[::3]) == sum(sq[1::3]) == sum(sq[2::3]) == sum(sq[:3]) == sum(sq[3:6]) == sum(sq[6:])


def is_magical(sq):
	return len(set([sum(sq[i * 3:(i + 1) * 3]) for i in range(3)] + [sum(sq[i::3]) for i in range(3)] + [sq[4 - 2 * i] + sq[4] + sq[4 + 2 * i] for i in range(1, 3)])) == 1


def is_magical(sq):
	return all((sum(sq[i * 3:(i + 1) * 3]) == sum(sq[i:9:3]) for i in range(0, 3)))


def is_magical(s):
	return sum(s[::3]) == sum(s[1::3]) == sum(s[2::3]) == 15


def is_magical(sq):
	N = int(len(sq) ** 0.5)
	res = sum(sq[::N + 1])
	return res == sum(sq[N - 1:-1:N - 1]) and all((sum(sq[i * N:(i + 1) * N]) == sum(sq[i::N]) == res for i in range(N)))


def is_magical(sq):
	return all((sum(sq[i * 3:i * 3 + 3]) == sum(sq[i::3]) == 15 for i in range(3))) and sum(sq[::4]) == 15


is_magical = lambda l: len(l) == 9 and len(list(set(l))) == 9 and (l[0] + l[1] + l[2] == 15) and (l[3] + l[4] + l[5] == 15) and (l[6] + l[7] + l[8] == 15) and (l[0] + l[3] + l[6] == 15) and (l[1] + l[4] + l[7] == 15) and (l[2] + l[5] + l[8] == 15) and (l[0] + l[4] + l[8] == 15) and (l[2] + l[4] + l[6] == 15)


def is_magical(sq):
	sums = '123 456 789 147 258 369 159 357'.split()
	return all((check(sq, x) == 15 for x in sums))

def check(sq, entries):
	return sum((sq[x - 1] for x in map(int, entries)))


def is_magical(sq):
	c = sum(sq[:3])
	ls = [sq[i:i + 3] for i in range(0, 9, 3)]
	ls2 = list(zip(*ls))
	if sum([ls[i][i] for i in range(3)]) != sum([ls[i][2 - i] for i in range(3)]):
		return False
	return True if ([sum(i) for i in ls] + [sum(i) for i in ls2]).count(c) == 6 else False


def is_magical(sq):
	(a, b, c, j, k, l, x, y, z) = sq
	return a + b + c == j + k + l == x + y + z == a + j + x == b + k + y == c + l + z == a + k + z == c + k + x