Results for “TypeError”

Showing 1–10 of 12

  1. Challenge

    Strings don't change

    code[0] = "X" stops with a TypeError, because Python strings can't be changed. Predict the crash, find out what methods and slices really give, build a new string instead, then swap a letter in the…

    Fix the code Easy 3 stages strings immutability slicing TypeError
  2. Challenge

    input() returns text

    A crew count read with input() crashes when 1 is added to it. Predict the crash, find out what input() really returns, fix it with int(), then write a packing tool that reads two numbers.

    Fix the code Easy 3 stages input int TypeError type conversion
  3. Challenge

    Flight software review

    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…

    Fix the code Hard 2 stages project debugging SyntaxError TypeError
  4. Challenge

    Read the traceback

    A Python program stops with a traceback. Read it from the bottom up to find the error, the function and the line, fix the bug there, then follow a longer traceback through four calls to a second bug.

    Fix the code Easy 2 stages errors traceback KeyError TypeError
  5. Challenge

    Missing reading

    …of a number, and the check from "Alert level" stops with a TypeError in the middle of a pass. Extend your check so a missing reading is reported, not crashed on, then handle missing values in the…

    Write the code Medium 2 stages if else None is None
  6. Challenge

    Real JSON

    …but response_text is text, and the program stops with TypeError: string indices must be integers . Turn the text into a dict with json.loads() , then add a line for crewed : Launch: Lumen-3 Provider…

    Write the code Easy 2 stages json json.loads modules import
  7. Challenge

    Test the error

    …a version that doesn't raise at all, and one that raises TypeError instead; your check must fail on both. The message, and what must still work A function that refuses everything would pass your test…

    Write the code Medium 2 stages testing assert try except