{"record":{"id":"310fa706d50fec0a","repo":"TheAlgorithms/Python","slug":"the-denominator-cannot-be-less-than-0","errorCode":null,"errorMessage":"The Denominator Cannot be less than 0","messagePattern":"The Denominator Cannot be less than 0","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"maths/numerical_analysis/proper_fractions.py","lineNumber":27,"sourceCode":"\n    >>> proper_fractions(10)\n    ['1/10', '3/10', '7/10', '9/10']\n    >>> proper_fractions(5)\n    ['1/5', '2/5', '3/5', '4/5']\n    >>> proper_fractions(-15)\n    Traceback (most recent call last):\n        ...\n    ValueError: The Denominator Cannot be less than 0\n    >>> proper_fractions(0)\n    []\n    >>> proper_fractions(1.2)\n    Traceback (most recent call last):\n        ...\n    ValueError: The Denominator must be an integer\n    \"\"\"\n\n    if denominator < 0:\n        raise ValueError(\"The Denominator Cannot be less than 0\")\n    elif isinstance(denominator, float):\n        raise ValueError(\"The Denominator must be an integer\")\n    return [\n        f\"{numerator}/{denominator}\"\n        for numerator in range(1, denominator)\n        if gcd(numerator, denominator) == 1\n    ]\n\n\nif __name__ == \"__main__\":\n    from doctest import testmod\n\n    testmod()\n","sourceCodeStart":9,"sourceCodeEnd":41,"githubUrl":"https://github.com/TheAlgorithms/Python/blob/f5988cc09713315817df6a7e327e258013a94440/maths/numerical_analysis/proper_fractions.py#L9-L41","documentation":"Error \"The Denominator Cannot be less than 0\" thrown in TheAlgorithms/Python.","triggerScenarios":"Thrown at maths/numerical_analysis/proper_fractions.py:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a denominator greater than 0."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f5988cc09713315817df6a7e327e258013a94440","analyzedAt":"2026-08-14T17:30:07.041Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}