Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print a message confirming the device is secure.
Raspberry Pi
print("Device security status: [1]")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'vulnerable' or 'offline' which indicate insecurity or no connection.
✗ Incorrect
The device should report 'secured' to confirm it is protected.
2fill in blank
mediumComplete the code to check if the device is connected to a secure network.
Raspberry Pi
if network_status == '[1]': print("Network is secure")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'disconnected' or 'untrusted' which do not mean secure.
✗ Incorrect
The condition should check for 'secure' to confirm network safety.
3fill in blank
hardFix the error in the code that checks device authentication.
Raspberry Pi
if device.authenticated [1] True: print("Access granted")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '==' causes syntax errors.
✗ Incorrect
Use '==' to compare values in a condition, '=' is assignment and causes error.
4fill in blank
hardFill both blanks to create a dictionary of device statuses for devices with battery level above 20.
Raspberry Pi
device_status = {device_id: status for device_id, status in devices.items() if status['[1]'] > 20 and status['[2]'] == 'active'} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'signal_strength' or 'device_id' in conditions which are incorrect.
✗ Incorrect
We check 'battery_level' > 20 and 'status' == 'active' to filter devices.
5fill in blank
hardFill all three blanks to create a dictionary of device names in uppercase for devices with signal above 50 and status 'online'.
Raspberry Pi
device_names = { [1]: [2].upper() for [3], info in devices.items() if info['signal'] > 50 and info['status'] == 'online'} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up keys and values or using wrong variable names.
✗ Incorrect
We use device_id as key, info['name'].upper() as value, and iterate with device_id, info.