
Boss
Boss: Observatory Report

Boss Fight!
Every passing test breaks a shield.
High on Mount Lumen, the Guild's observatory tracks the stars that guide night ships between islands. The astronomers scribble sightings in a shared notebook, and nobody agrees on spacing or capitals:
2026-11-20 | Star: Vega | mag 0.03 | observer: ada
2026-11-21|star: SIRIUS|mag -1.46|Observer: Bo
cloudy all night :(
The Guild needs a clean report before the lanterns can be aligned.
Assignment
parse_sighting(line)returnsNoneunless the whole line (after.strip()) has the shape date|star: NAME|mag NUMBER|observer: NAME, with any spacing around|and:and any letter case for the labels. Otherwise return a dict:{"date": date(...), "star": "Sirius", "mag": Decimal("-1.46"), "observer": "Bo"}, names title-cased, magnitude aDecimal. Magnitudes may be negative and have decimals.report(lines)returns this exact multi-line string (no trailing newline):
OBSERVATORY REPORT
Sightings: 4 (1 skipped)
Nights: 2026-11-20 to 2026-11-22
Brightest: Sirius (-1.46)
Most seen: Vega x2
Observers: Ada, Bo, Cy
- skipped = lines that didn't parse (ignore completely blank lines);
- Nights = earliest to latest date;
- Brightest = the lowest magnitude (astronomers are funny like that);
- Most seen = the star seen most often (on a tie, the one seen first);
- Observers = unique observer names, sorted, joined by
", ".
You may assume at least one line parses.
parse_sighting(line)returnsNoneunless the whole line (after.strip()) has the shape date|star: NAME|mag NUMBER|observer: NAME, with any spacing around|and:and any letter case for the labels. Otherwise return a dict:{"date": date(...), "star": "Sirius", "mag": Decimal("-1.46"), "observer": "Bo"}, names title-cased, magnitude aDecimal. Magnitudes may be negative and have decimals.report(lines)returns this exact multi-line string (no trailing newline):
OBSERVATORY REPORT
Sightings: 4 (1 skipped)
Nights: 2026-11-20 to 2026-11-22
Brightest: Sirius (-1.46)
Most seen: Vega x2
Observers: Ada, Bo, Cy
- skipped = lines that didn't parse (ignore completely blank lines);
- Nights = earliest to latest date;
- Brightest = the lowest magnitude (astronomers are funny like that);
- Most seen = the star seen most often (on a tie, the one seen first);
- Observers = unique observer names, sorted, joined by
", ".
You may assume at least one line parses.
main.py Python sleeping
Press Run to try your code, then Check to test it.