0 out of 464 challenges solved

Adjacent Coordinates Extraction

Write a Python function `get_adjacent_coordinates` that takes a tuple representing a coordinate in a 2D grid and returns a list of all adjacent coordinates, including diagonals. Each coordinate is represented as a tuple of two integers `(x, y)`. Adjacent coordinates are those that differ by at most 1 in either the x or y direction.

#### Example Usage
```python [main.nopy]
print(get_adjacent_coordinates((3, 4)))
# Expected output: [(2, 3), (2, 4), (2, 5), (3, 3), (3, 5), (4, 3), (4, 4), (4, 5)]

print(get_adjacent_coordinates((0, 0)))
# Expected output: [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
```

#### Constraints
- The input tuple will always contain exactly two integers.
- The output list should not include the input coordinate itself.
- The order of the coordinates in the output list does not matter.
def get_adjacent_coordinates(coord):
    """
    Given a tuple representing a coordinate in a 2D grid, return a list of all adjacent coordinates.

    Args:
    coord (tuple): A tuple of two integers representing the coordinate.

    Returns:
    list: A list of tuples representing adjacent coordinates.
    """
    # Placeholder for the solution
    pass