Example
Comments in Code
How to write comments in Python. Comments help other programmers understand your code.
Showing 1–10 of 14
Example
How to write comments in Python. Comments help other programmers understand your code.
Challenge
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.
Challenge
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.
Challenge
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…
Challenge
…the record dict, then let it return None for blank, comment and damaged lines so the loop only keeps real records.
Challenge
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…
Challenge
…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.
Quiz
…the way you will read code every day. What the quiz covers Comments, print() with sep and end , f-strings Variable names, data types and type conversion Arithmetic: // , % , ** and operator precedence…
Challenge
…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…
Challenge
…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