{"record":{"id":"834fadec688efeb4","repo":"TheAlgorithms/Python","slug":"invalid-angle-should-be-an-integer-or-float","errorCode":null,"errorMessage":"Invalid angle. Should be an integer or float.","messagePattern":"Invalid angle\\. Should be an integer or float\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"physics/horizontal_projectile_motion.py","lineNumber":37,"sourceCode":"# Importing packages\nfrom math import radians as deg_to_rad\nfrom math import sin\n\n# Acceleration Constant on Earth (unit m/s^2)\ng = 9.80665\n\n\ndef check_args(init_velocity: float, angle: float) -> None:\n    \"\"\"\n    Check that the arguments are valid\n    \"\"\"\n\n    # Ensure valid instance\n    if not isinstance(init_velocity, (int, float)):\n        raise TypeError(\"Invalid velocity. Should be an integer or float.\")\n\n    if not isinstance(angle, (int, float)):\n        raise TypeError(\"Invalid angle. Should be an integer or float.\")\n\n    # Ensure valid angle\n    if angle > 90 or angle < 1:\n        raise ValueError(\"Invalid angle. Range is 1-90 degrees.\")\n\n    # Ensure valid velocity\n    if init_velocity < 0:\n        raise ValueError(\"Invalid velocity. Should be a positive number.\")\n\n\ndef horizontal_distance(init_velocity: float, angle: float) -> float:\n    r\"\"\"\n    Returns the horizontal distance that the object cover\n\n    Formula:\n        .. math::\n            \\frac{v_0^2 \\cdot \\sin(2 \\alpha)}{g}\n","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/TheAlgorithms/Python/blob/f5988cc09713315817df6a7e327e258013a94440/physics/horizontal_projectile_motion.py#L19-L55","documentation":"Error \"Invalid angle. Should be an integer or float.\" thrown in TheAlgorithms/Python.","triggerScenarios":"Thrown at physics/horizontal_projectile_motion.py:37 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the angle as an int or float."],"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"}