Write a method `alternate_sq_sum()` (JS: `alternateSqSum` ) that takes an array of integers as input and finds the sum of squares of the elements at even positions (*i.e.,* 2nd, 4th, *etc.*) plus the sum of the rest of the elements at odd position.

NOTE:
The values at even *position* need to be squared. For a language with zero-based indices, this will occur at oddly-indexed locations. For instance, in Python, the values at indices 1, 3, 5, *etc.* should be squared because these are the second, fourth, and sixth positions in the list.
For Example:

```python
alternate_sq_sum([11, 12, 13, 14, 15]) #should return 379
```

Explanation:

Elements at indices 0, 2, 4 are 11, 13, 15 and they are at odd positions as 11 is at position #1, 13 is at position #3 and 15 at #5.

Elements at indices 1, 3 are 12 and 14 and they are at even position.
So we need to add 11, 13, 15 as they are and square of 12 and 14

--> 11 + 13 + 15 + 12^2 + 14^2
  = 11 + 13 + 15 + 144 + 196
  = 379

For empty arrays, result should be 0 (zero) (except for Haskell).

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def alternate_sq_sum(arr):
	

Solutions:
def alternate_sq_sum(arr):
	return sum([x ** 2 if i % 2 == 1 else x for (i, x) in enumerate(arr)])


def alternate_sq_sum(arr):
	return sum((x * x for x in arr[1::2])) + sum(arr[::2])


def alternate_sq_sum(arr):
	return sum((num if not i % 2 else num ** 2 for (i, num) in enumerate(arr)))


def alternate_sq_sum(arr):
	return sum((v * v if i & 1 else v for (i, v) in enumerate(arr)))


def alternate_sq_sum(arr):
	return sum([x ** 2 if pos % 2 != 0 else x for (pos, x) in enumerate(arr)])


def alternate_sq_sum(arr):
	return sum(arr[::2]) + sum(map(lambda x: x * x, arr[1::2]))


def alternate_sq_sum(arr):
	return sum((n ** 2 if c % 2 == 1 else n for (c, n) in enumerate(arr)))


def alternate_sq_sum(a):
	return sum((a[i] ** 2 if i % 2 else a[i] for i in range(len(a)))) or 0