0 out of 464 challenges solved
Write a Python function `last_digit(n)` that takes an integer `n` as input and returns the last digit of the number. The function should handle both positive and negative integers. #### Example Usage ```python [main.nopy] print(last_digit(123)) # Output: 3 print(last_digit(-25)) # Output: 5 print(last_digit(0)) # Output: 0 ``` #### Constraints - The input `n` will always be an integer. - The function should return a single integer representing the last digit of `n`.
def last_digit(n): """ Returns the last digit of the given integer n. Args: n (int): The input integer. Returns: int: The last digit of n. """ # Your code here pass