Complete the code to set the data quality flag to 'GOOD' when the sensor reading is valid.
if sensor_reading_valid: data_quality_flag = '[1]'
The flag 'GOOD' indicates the sensor reading is valid and reliable.
Complete the code to mark the data quality flag as 'BAD' if the sensor reading is out of range.
if sensor_reading < min_value or sensor_reading > max_value: data_quality_flag = '[1]'
The 'BAD' flag is used when data is outside expected limits, indicating poor quality.
Fix the error in the code to correctly assign the 'UNKNOWN' flag when sensor status is unclear.
if sensor_status == 'uncertain': data_quality_flag = '[1]'
The 'UNKNOWN' flag is used when the sensor status cannot be determined clearly.
Fill both blanks to set the flag to 'ERROR' if sensor reading is None and log the issue.
if sensor_reading is [1]: data_quality_flag = '[2]' log_issue('Sensor reading missing')
When the reading is None, it means missing data, so the flag should be 'ERROR'.
Fill all three blanks to create a dictionary mapping sensor IDs to their data quality flags, including only sensors with 'GOOD' or 'UNKNOWN' flags.
quality_map = {sensor_id: data_quality_flags[sensor_id] for sensor_id in sensor_ids if data_quality_flags[sensor_id] [1] ['GOOD', 'UNKNOWN'] and sensor_id [2] None and data_quality_flags[sensor_id] [3] 'BAD'}The 'in' operator checks if the flag is in the list. 'is not' checks sensor_id is not None. '!=' excludes 'BAD' flags.