{"record":{"id":"4a530142437de45d","repo":"TheAlgorithms/Python","slug":"the-word-parameter-should-be-a-string-of-length-gr","errorCode":null,"errorMessage":"The word parameter should be a string of length greater than 0.","messagePattern":"The word parameter should be a string of length greater than 0\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"backtracking/word_search.py","lineNumber":144,"sourceCode":"    board_error_message = (\n        \"The board should be a non empty matrix of single chars strings.\"\n    )\n\n    len_board = len(board)\n    if not isinstance(board, list) or len(board) == 0:\n        raise ValueError(board_error_message)\n\n    for row in board:\n        if not isinstance(row, list) or len(row) == 0:\n            raise ValueError(board_error_message)\n\n        for item in row:\n            if not isinstance(item, str) or len(item) != 1:\n                raise ValueError(board_error_message)\n\n    # Validate word\n    if not isinstance(word, str) or len(word) == 0:\n        raise ValueError(\n            \"The word parameter should be a string of length greater than 0.\"\n        )\n\n    len_board_column = len(board[0])\n    for i in range(len_board):\n        for j in range(len_board_column):\n            if exits_word(\n                board, word, i, j, 0, {get_point_key(len_board, len_board_column, i, j)}\n            ):\n                return True\n\n    return False\n\n\nif __name__ == \"__main__\":\n    import doctest\n\n    doctest.testmod()","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/TheAlgorithms/Python/blob/f5988cc09713315817df6a7e327e258013a94440/backtracking/word_search.py#L126-L162","documentation":"Raised by doppler_effect() in physics/doppler_frequency.py when the computed observed frequency is <= 0. With f = f0*(v + v0)/(v - vs), a non-positive result means the numerator or denominator flipped sign: the source outruns the wave toward the observer (vs > v) or the observer recedes faster than the wave propagates (v0 < -v with the source behind). Physically the simple Doppler formula has broken down, so the library refuses the value.","triggerScenarios":"doppler_effect(100, 330, 10, 340): source at 340 m/s > 330 m/s wave speed. doppler_effect(100, 330, -340, 10): observer receding at 340 m/s > wave speed. Any supersonic closing speed or observer receding faster than v.","commonSituations":"Supersonic aircraft / Mach > 1 simulations where the classical Doppler formula does not apply; sign-convention mistakes — obs_vel is positive when moving toward the source, src_vel positive when moving toward the observer, and swapped signs can flip the result negative.","solutions":["Check the sign convention: obs_vel + toward source, src_vel + toward observer; verify your signs before calling.","Reject or special-case inputs where src_vel > wave_vel or obs_vel < -wave_vel (supersonic regimes need shock physics, not this formula).","Catch ValueError and flag the input pair as out of model range."],"exampleFix":"# before\nf = doppler_effect(100, 330, 10, 340)  # supersonic source -> ValueError\n\n# after\nif src_vel >= wave_vel or obs_vel <= -wave_vel:\n    raise ValueError(\"supersonic regime: Doppler formula invalid\")\nf = doppler_effect(100, 330, 10, src_vel)","handlingStrategy":"validation","validationCode":"if src_vel > wave_vel or obs_vel < -wave_vel:\n    raise ValueError(\"supersonic regime outside Doppler model\")\nf = doppler_effect(org_freq, wave_vel, obs_vel, src_vel)","typeGuard":null,"tryCatchPattern":"try:\n    f = doppler_effect(f0, v, v0, vs)\nexcept ValueError as e:\n    if \"Non-positive frequency\" in str(e):\n        sign_hint = 'src_vel too large' if vs > v else 'obs_vel too negative (sign convention?)'\n        raise ValueError(sign_hint) from e\n    raise","preventionTips":["obs_vel positive = toward source; src_vel positive = toward observer — recheck signs.","Reject supersonic inputs before the call.","Compute the expected sign of (v + v0) and (v - vs) in debug logs when tuning."],"tags":["physics","acoustics","domain-error","supersonic"],"backgroundTag":null,"analyzedSha":"f5988cc09713315817df6a7e327e258013a94440","analyzedAt":"2026-08-14T17:30:07.041Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}