{"record":{"id":"bdf9364f1f1ca140","repo":"TheAlgorithms/Python","slug":"invalid-velocity-should-be-an-integer-or-float","errorCode":null,"errorMessage":"Invalid velocity. Should be an integer or float.","messagePattern":"Invalid velocity\\. Should be an integer or float\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"physics/horizontal_projectile_motion.py","lineNumber":34,"sourceCode":"For more info: https://en.wikipedia.org/wiki/Projectile_motion\n\"\"\"\n\n# 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:","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/TheAlgorithms/Python/blob/f5988cc09713315817df6a7e327e258013a94440/physics/horizontal_projectile_motion.py#L16-L52","documentation":"Error \"Invalid velocity. Should be an integer or float.\" thrown in TheAlgorithms/Python.","triggerScenarios":"Thrown at physics/horizontal_projectile_motion.py:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the velocity 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"}