Complete the code to start data collection from sensors.
scada.start_data_collection([1])The start_data_collection function requires a list of sensors to collect data from, so sensor_list is the correct argument.
Complete the code to trigger predictive maintenance alert when threshold is exceeded.
if sensor.reading > [1]: scada.trigger_alert('maintenance_required')
The sensor.threshold is the correct value to compare the reading against to decide if maintenance is needed.
Fix the error in the code to correctly calculate the moving average of sensor data.
moving_avg = sum(sensor.data[-[1]:]) / [1]
The window_size defines how many recent data points to average, so it should be used in both places.
Fill both blanks to filter sensor data for anomalies above a threshold.
anomalies = [d for d in sensor.data if d [1] [2]]
To find anomalies above the threshold, use the greater than operator and compare to sensor.threshold.
Fill all three blanks to create a dictionary of sensor IDs and their average readings above threshold.
avg_readings = {sensor.[1]: sum(readings) / len(readings) for sensor, readings in data.items() if sum(readings) / len(readings) [2] [3]The dictionary keys should be sensor IDs, and the average readings filtered by being greater than the sensor's threshold.