Complete the code to turn on a smart light using a simple command.
smart_light.[1]()The method turn_on() is commonly used to switch on smart devices like lights.
Complete the code to check if the smart thermostat is currently active.
if thermostat.[1]: print('Thermostat is active')
The property is_on is a boolean that tells if the device is currently turned on.
Fix the error in the code to set the smart speaker volume to 5.
smart_speaker.volume [1] 5
The single equals sign = is used to assign a value in programming.
Fill both blanks to create a dictionary of smart devices with their status.
devices = { 'light': [1], 'thermostat': [2] }Boolean values True and False are used to represent device status as on or off.
Fill all three blanks to create a dictionary comprehension for devices with volume above 3.
loud_devices = { [1]: [2] for [3] in devices if devices[[3]]['volume'] > 3 }The comprehension uses device_name as the key and volume as the value, iterating over device names.