Results for “comments”

10 results

  1. Challenge

    Wrong line commented out

    A real check is commented out and a debug line is left on. Use # comments to put the pre-flight checklist script back in order. A beginner Python challenge on comments.

    Fix the code Easy 2 stages comments debugging print
  2. Challenge

    Skip blanks and comments

    Extend the feed parser so continue skips blank lines and comment lines, then report damaged lines with too few fields instead of crashing, with a count of parsed and damaged lines.

    Write the code Medium 2 stages for loop continue strip startswith
  3. Challenge

    Survive bad lines

    Extend the feed parser from "Skip blanks and comments": a faulty sensor sends ERR and float() stops the program. Skip lines that fail to convert and count them, then let one try cover short lines too…

    Write the code Medium 2 stages errors try except ValueError
  4. Challenge

    Line to record

    The parser from "Skip blanks and comments" prints each reading and forgets it. The rest of the ground software needs the readings themselves: the alert check, the charts, the daily report. Each one…

    Write the code Easy 2 stages dictionaries lists parsing records
  5. Challenge

    Test the parser

    …for a good line first, then None for a blank line, a comment and a line with a missing field, so a broken parser can't pass.

    Write the code Medium 2 stages testing assert parsing None
  6. Challenge

    Off-by-one slice

    …in last_index . Check them with the prints in the comments, and remove those lines before you check. Modify. Fix the slice so it takes the four digits after the dash. It must print: Container number…

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

    Mission config

    …rover test drive in variables with the names given in the comments, each with the right type, then print them one per line: Rover: Pathfinder-2 Wheels: 6 Battery: 3.6 kWh Autonomous: False

    Write the code Easy 3 stages variables data types int float
  8. Challenge

    What arrived?

    …type it should have, into the new variables named in the comments, then print each new value and its type: altitude_km: 408 <class 'int'> speed_kms: 7.66 <class 'float'> crew: 3 <class 'int'>

    Write the code Easy 3 stages type() data types type conversion sensor data
  9. Challenge

    Real JSON

    …the launch arrived as a ready-made Python dict, with a comment saying the JSON had already been turned into one. That was a shortcut. A real API sends text, and the first thing any program does with…

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