0 out of 464 challenges solved

Sum Even Numbers at Even Positions

Write a Python function `sum_even_and_even_index` that takes a list of integers as input and returns the sum of all even numbers that are located at even indices in the list. Indices are considered zero-based, so the first element is at index 0, the second at index 1, and so on.

#### Example Usage
```python [main.nopy]
print(sum_even_and_even_index([5, 6, 12, 1, 18, 8]))  # Output: 30
print(sum_even_and_even_index([3, 20, 17, 9, 2, 10, 18, 13, 6, 18]))  # Output: 26
print(sum_even_and_even_index([5, 6, 12, 1]))  # Output: 12
```

#### Constraints
- The input list will contain integers only.
- The list can be empty, in which case the function should return 0.
def sum_even_and_even_index(arr):
    """
    Calculate the sum of even numbers at even indices in the list.

    Args:
        arr (list): A list of integers.

    Returns:
        int: The sum of even numbers at even indices.
    """
    # Initialize the sum to 0
    total = 0
    # Iterate through the list
    # Placeholder for the solution
    return total