Your question is Parse Framed Sensor Data Packets. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a list of byte values stream representing data received over a serial interface, parse all valid sensor packets and return their decoded fields. Each packet has the format [0xAA, length, sensor_id, payload..., checksum], where length is the number of bytes in [sensor_id, payload...], and checksum equals (length + sensor_id + sum(payload)) % 256. Ignore noise bytes before a header, skip malformed packets, and continue scanning for the next valid packet.
def parse_sensor_packets(stream):