Challenge
Docstring and type hints
…says what it returns and what the reserve means, then add type hints for its parameters and return value; the tests read both from the function itself.
Showing 1–10 of 40
Challenge
…says what it returns and what the reserve means, then add type hints for its parameters and return value; the tests read both from the function itself.
Challenge
…and text that only looks like numbers. Predict what type() shows, find the values that need converting, then convert a packet yourself.
Challenge
…out the crew after the next docking. Whatever number you type, it crashes. Predict what happens, find out why input() is behind it, fix it, then write a packing tool that reads two numbers. Predict…
Challenge
A status line crashes with a TypeError because it joins text and a number with +. Predict it, read the error, fix it with str(), then build a docking status line.
Challenge
…decimals and True/False. A PRIMM challenge on Python data types.
Challenge
…with a message that shows the bad value, then raise TypeError, checked first, when the length isn't a number at all.
Challenge
…are written. Investigate and modify Investigate. Store the type of the readings in reading_type : int , float , str or bool . Modify. The readings arrive as text, so leave the two lines that set them…
Challenge
A 40-line pre-burn check has five bugs: a syntax error, a type error, a wrong key, an index out of range and a reversed decision. Read each error to fix the four that crash, then find the one that…
Challenge
…and dashes too, so commands match however operators type them.
Challenge
…line just above it is where it happened. Fill in error_type , crash_function and crash_line at the end of the program, then fix the bug on that line so the program prints: Average: 695.0 K Fix the…