0
0
Intro to Computingfundamentals~10 mins

Smart home devices in Intro to Computing - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to turn on a smart light using a simple command.

Intro to Computing
smart_light.[1]()
Drag options to blanks, or click blank then click option'
Aturn_on
Bactivate
Cstart
Denable
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'activate' or 'start' which are not standard method names for lights.
2fill in blank
medium

Complete the code to check if the smart thermostat is currently active.

Intro to Computing
if thermostat.[1]:
    print('Thermostat is active')
Drag options to blanks, or click blank then click option'
Astatus
Bis_on
Cactive
Dpower
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'status' which might be a string, not a boolean.
3fill in blank
hard

Fix the error in the code to set the smart speaker volume to 5.

Intro to Computing
smart_speaker.volume [1] 5
Drag options to blanks, or click blank then click option'
A=
B=>
C===
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which compares values instead of assigning.
4fill in blank
hard

Fill both blanks to create a dictionary of smart devices with their status.

Intro to Computing
devices = { 'light': [1], 'thermostat': [2] }
Drag options to blanks, or click blank then click option'
ATrue
B'on'
CFalse
D'off'
Attempts:
3 left
💡 Hint
Common Mistakes
Using strings like 'on' or 'off' instead of boolean values.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension for devices with volume above 3.

Intro to Computing
loud_devices = { [1]: [2] for [3] in devices if devices[[3]]['volume'] > 3 }
Drag options to blanks, or click blank then click option'
Adevice_name
Bdevices[device_name]['volume']
Ddevice
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.