Q:

How to compare the sum of the square of the elements of two arrays?

I'm doing katas (practices) at codewars.com to practice the learning I'm getting in Python. This is the kata :

Given two integer arrays a, b, both of length >= 1, create a program
  that returns True if the sum of the squares of each element in a is
  strictly greater than the sum of the square of each element in b.

This is the code that I tried:
def array_madness(a,b):
    a = sum(i**2 for i in a)
    b = sum(i**2 for i in b)

    return True if a > b else False

This is the test I need to pass:
test.assert_equals(array_madness([4, 5, 6], [1, 2, 3]),True)
test.assert_equals(array_madness( [1, 2, 3],[4, 5, 6]),False)

A:

You copied the problem description wrong.  It's the sum of the squares of a, and the sum of the cubes of b (it's doing a different calculation for the two arrays).  The following should work:
def array_madness(a,b):
    return sum(i**2 for i in a) > sum(i**3 for i in b)

