Challenge
Log to a file
…the day's mission log entries to mission.log with with open(), one per line, read the file back and print it, then add an append_entry() function that adds lines at the end without wiping what is…
Showing 1–10 of 20
Challenge
…the day's mission log entries to mission.log with with open(), one per line, read the file back and print it, then add an append_entry() function that adds lines at the end without wiping what is…
Challenge
…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…
Challenge
…print one last line: Saved summary.json The hidden tests open summary.json and compare it with what they expect.
Challenge
…store it in converted_type . Then find out what bool(valve_open) gives, True or False , and store it in bool_of_valve . Run them to check, then remove any lines you added before you check. Modify…
Challenge
…basic operator training to the commander's approval for opening the outer hatch, and the airlock's control panel checks them before it does anything. Check one action for one crew member, then the…
Article Mini projects
…log""" if not self.log_file.exists(): return [] try: with open(self.log_file, 'r') as f: events = json.load(f) # Verify chain integrity for i, event in enumerate(events): # Reconstruct the message…
Challenge
…to undock Close the hatch before undocking With the hatch OPEN, as in the starter code, it prints the second one.
Challenge
The monitoring system raises the same alert over and over. Group repeats of an alert that come within 60 seconds of the first into one line with a count, in the order they first appeared, then add the…
Example
The global keyword allows modifying a global variable inside a function.
Quiz
Free beginner quiz on Python if, elif and else: 15 questions on conditions, comparison and logical operators and indentation, with instant answers.