Results for “types”

Showing 11–20 of 40

  1. Challenge

    Read the traceback

    …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…

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

    Readings that won't add

    …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…

    Fix the code Easy 3 stages type conversion int float str
  3. 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
  4. Challenge

    Approved payloads

    …whole items rather than parts of text, then normalise IDs typed by hand and print a clear cleared or not-cleared message.

    Write the code Easy 2 stages lists in membership if
  5. Challenge

    Config loader

    …settings over a copy of the defaults, check each value's type and range and report every problem in one go, then wrap it all in a load_config() that never crashes, even on broken JSON.

    Write the code Hard 3 stages project json configuration validation
  6. Challenge

    Command parser

    Write parse_command(), which turns typed commands such as burn 12.5 or set mode safe into tuples and raises ValueError with a reason for anything malformed, then run a whole batch of commands and…

    Write the code Medium 2 stages project parsing strings split
  7. Challenge

    Fuel for a burn

    …can last part of a second, like 12.4. When you press Run, type the number in the console. When you check, the tests type it for you. What the burn leaves The flight director also wants to know what…

    Write the code Easy 2 stages input float type conversion multiplication
  8. Challenge

    Round or cut?

    int() cuts the decimals off, round() rounds, and round(2.5) gives 2. Predict the difference, investigate Python's rounding rule, then round a fuel reading two ways.

    Write the code Medium 3 stages int round rounding type conversion
  9. Challenge

    Prints instead of returns

    …gives back and store it, as text, in returned . Then print type(engine_k) and store the type's name in value_type . Remove any lines you added before you check. Modify. Make to_kelvin() give its…

    Fix the code Easy 3 stages functions return print None