CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-wtfpython

Educational collection of surprising Python code snippets that demonstrate counter-intuitive behaviors and language internals

Overall
score

93%

Overview
Eval results
Files

rubric.jsonevals/scenario-10/

{
  "context": "This criteria evaluates how well the engineer applies Python's built-in numeric operations and understands key numeric behaviors documented in wtfpython (banker's rounding via round(), string conversion limits, and float precision) to implement a financial calculator module.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Uses round() function",
      "description": "Uses Python's built-in round() function which implements banker's rounding (round half to even) by default to implement the round_amount function",
      "max_score": 30
    },
    {
      "name": "String length validation",
      "description": "Checks the length of the string before conversion using len() and raises ValueError for strings exceeding 4000 digits to prevent performance issues related to Python's integer string conversion limits",
      "max_score": 25
    },
    {
      "name": "Uses int() or float()",
      "description": "Uses Python's built-in int() or float() conversion functions to convert strings to numbers in the convert_string_to_number function",
      "max_score": 15
    },
    {
      "name": "Float precision check",
      "description": "Uses comparison with an epsilon value (e.g., abs(value - round(value, 10)) < 1e-9) or checks decimal representation to detect float precision errors in the is_precise function",
      "max_score": 30
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/pypi-wtfpython

tile.json