Results for “strings”

Showing 21–30 of 38

  1. 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
  2. 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
  3. Challenge

    Decimal comma

    An operator types 42,5 and float() crashes with a ValueError. Predict it, find out why, accept both commas and dots with replace(), then read pressures written like 1 013,25.

    Fix the code Easy 3 stages strings replace float ValueError
  4. Challenge

    Normalise a command

    Turn " Launch " into launch with strip() and lower(), check it against the command list, then accept underscores and dashes too, so commands match however operators type them.

    Write the code Easy 3 stages strings strip lower replace
  5. Challenge

    Sensor ID parts

    Split a sensor ID like ENG-2 into its subsystem and its unit number as an int, work out the next ID, then handle subsystems with a dash in their name using rsplit().

    Write the code Medium 2 stages strings split rsplit int
  6. Challenge

    Mission Control online

    Print status lines that a monitoring system reads character by character. A first Python challenge on exact output with print(), right in your browser.

    Write the code Easy 2 stages print output strings beginner
  7. Challenge

    Real JSON

    …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: JAXA Status: Go…

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

    Telemetry from CSV

    …csv.DictReader Replace the old parser and its feed string: open telemetry.csv with newline="" , loop over csv.DictReader(csv_file) , and print each row in the same format as before: 09:30:05 ENG-2…

    Write the code Medium 2 stages csv csv.DictReader files open
  9. Challenge

    Crew roster

    …member: Kowalska Crew size: 4 Indexes start at 0, as in strings. crew[-1] is the last item whatever the list's length, and len(crew) counts the items. The whole roster Add the second in command, who…

    Write the code Easy 2 stages lists indexing negative index len