{"record":{"id":"fda8e06ead8215a1","repo":"TheAlgorithms/Python","slug":"input-value-of-number-number-must-be-an-intege-fda8e0","errorCode":null,"errorMessage":"Input value of [number={number}] must be an integer","messagePattern":"Input value of \\[number=(.+?)\\] must be an integer","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"maths/special_numbers/pronic_number.py","lineNumber":45,"sourceCode":"    True\n    >>> is_pronic(8)\n    False\n    >>> is_pronic(30)\n    True\n    >>> is_pronic(32)\n    False\n    >>> is_pronic(2147441940)\n    True\n    >>> is_pronic(9223372033963249500)\n    True\n    >>> is_pronic(6.0)\n    Traceback (most recent call last):\n        ...\n    TypeError: Input value of [number=6.0] must be an integer\n    \"\"\"\n    if not isinstance(number, int):\n        msg = f\"Input value of [number={number}] must be an integer\"\n        raise TypeError(msg)\n    if number < 0 or number % 2 == 1:\n        return False\n    number_sqrt = int(number**0.5)\n    return number == number_sqrt * (number_sqrt + 1)\n\n\nif __name__ == \"__main__\":\n    import doctest\n\n    doctest.testmod()\n","sourceCodeStart":27,"sourceCodeEnd":56,"githubUrl":"https://github.com/TheAlgorithms/Python/blob/f5988cc09713315817df6a7e327e258013a94440/maths/special_numbers/pronic_number.py#L27-L56","documentation":"Raised by is_pronic(number) in maths/special_numbers/pronic_number.py when the argument is not an int. The function checks whether number equals k*(k+1) using an integer square root; floats (including 6.0) are rejected by the strict isinstance check even when mathematically integral.","triggerScenarios":"Calling is_pronic(6.0), is_pronic('12'), or is_pronic(None). Large builtin ints (e.g. 9223372033963249500) are supported and return True; only the type, not size, is checked here.","commonSituations":"Values coming from float arithmetic or JSON deserialization; numpy scalar types failing isinstance(x, int) in some versions.","solutions":["Coerce integral floats first: is_pronic(int(x)) when x is integral","Type your data pipeline so pronic candidates stay ints (avoid float division/normalization)","Guard at your boundary with isinstance(n, int) and reject early"],"exampleFix":"// before\nis_pronic(6.0)  # TypeError\n\n// after\nis_pronic(int(6.0))  # True","handlingStrategy":"type-guard","validationCode":"if not isinstance(n, int) or isinstance(n, bool):\n    n = int(n)\nprint(is_pronic(n))","typeGuard":"def is_builtin_int(v) -> TypeGuard[int]:\n    return isinstance(v, int) and not isinstance(v, bool)","tryCatchPattern":"try:\n    is_pronic(n)\nexcept TypeError:\n    n = int(n)\n    is_pronic(n)","preventionTips":["Coerce integral floats at the boundary","Keep pronic candidates in int arithmetic","Reject strings/None early with your own validation"],"tags":["math","typeerror","type-checking","pronic"],"backgroundTag":null,"analyzedSha":"f5988cc09713315817df6a7e327e258013a94440","analyzedAt":"2026-08-14T17:30:07.041Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}