Results for “slicing”

Showing 1–10 of 14

  1. Challenge

    Redact the access code

    …last four characters of an access code with * using len(), slicing and string repetition, then find a code inside a log line and mask it there before the line is saved.

    Write the code Medium 2 stages strings slicing len replace
  2. Challenge

    Last five readings

    Show only the five most recent CO2 readings with the slice [-5:], as a dashboard does, then add a new reading and print how much the level changed across the window.

    Write the code Easy 2 stages lists slicing negative slice append
  3. Challenge

    Off-by-one slice

    A slice meant to take the number from the container tag CG-0042 gives -004. Predict it, work out where indexes start and where a slice ends, fix it, then slice a sample label yourself.

    Fix the code Easy 3 stages strings slicing indexing off-by-one
  4. Challenge

    Search the log

    Check whether a mission log line contains ERROR with in, find where it starts with find(), including the -1 it gives when there is nothing to find, then slice out the error message.

    Write the code Medium 2 stages strings in find slicing
  5. 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
  6. Challenge

    Telemetry report

    Extend the parser from "Parse a telemetry line" to read three readings from a multi-line feed, print each as one row, then turn them into a report with a header and aligned columns.

    Write the code Medium 2 stages strings split slicing f-strings