0 out of 464 challenges solved

Find First Digit

Write a Python function `first_digit(n)` that takes an integer `n` as input and returns the first digit of the number. The function should handle both positive and negative numbers.

#### Example Usage
```python [main.nopy]
print(first_digit(123))  # Output: 1
print(first_digit(-456)) # Output: 4
print(first_digit(7))    # Output: 7
```

#### Constraints
- The input `n` will be a non-zero integer.
def first_digit(n):
    """
    Returns the first digit of the given integer.

    Args:
    n (int): The input integer.

    Returns:
    int: The first digit of the number.
    """
    # Placeholder for the solution
    pass