sphinxy.sphinx module#
- exception sphinxy.sphinx.IncorrectAnswer#
Bases:
Exception
Exception to indicate an incorrect answer.
- class sphinxy.sphinx.Sphinx(name: str)#
Bases:
object
- check_riddle_answer(answer: str, return_hint: bool = False) str #
Evaluates the given answer to the riddle.
- Parameters:
answer (str) – The given answer to the riddle.
return_hint (bool, optional) – Controls whether a hint for the riddle should be returned. Defaults to False.
- Raises:
IncorrectAnswer – Exception for incorrect answer.
- Returns:
The result of the evaluation of the answer.
- Return type:
str
- introduce() str #
The Sphinx introduces itself.
- Returns:
The introduction speech.
- Return type:
str
- pose_riddle(include_hint: bool = False) tuple[str, str | None] #
Poses the stored riddle and a hint if requested.
- Parameters:
include_hint (bool, optional) – Set to True to ask for hint. Defaults to False.
- Returns:
- The riddle and a hint or an empty string or None
if no hint was requested.
- Return type:
tuple[str, str | None]