0 out of 464 challenges solved
Write a Python function `check_integer(text: str) -> bool` that determines whether a given string represents a valid integer. The function should return `True` if the string is a valid integer, and `False` otherwise. #### Requirements: - A valid integer can optionally start with a `+` or `-` sign, followed by one or more digits. - Strings containing non-numeric characters or empty strings should return `False`. #### Examples: ```python [main.nopy] check_integer("123") # True check_integer("-456") # True check_integer("+789") # True check_integer("12.3") # False check_integer("abc") # False check_integer("") # False ``` Implement the function to handle these cases.
def check_integer(text: str) -> bool: """ Check if the given string represents a valid integer. Args: text (str): The input string to check. Returns: bool: True if the string is a valid integer, False otherwise. """ # Strip any leading or trailing whitespace text = text.strip() # Placeholder for implementation pass