Complete the code to define a wearable device's main function.
def wearable_device(): return [1]
The function should return a string describing the device. Strings must be in quotes.
Complete the code to check if a wearable device is active.
is_active = [1] if is_active: print("Device is on")
Boolean True means the device is active. It must be capitalized in Python.
Fix the error in the code to correctly calculate battery percentage.
battery_level = 80 max_battery = 100 percentage = battery_level [1] max_battery * 100 print(percentage)
To find the percentage, divide battery_level by max_battery, then multiply by 100.
Fill both blanks to create a dictionary of wearable devices and their battery levels.
devices = {"watch": [1], "earbuds": [2]Battery levels are numbers, so use 85 and 90 without quotes.
Fill both blanks to filter devices with battery above 50%.
filtered = {k: v for k, v in devices.items() if v [1] [2]
print(filtered)
# Expected output: {'watch': 85, 'earbuds': 90}The code filters devices where battery level (v) is greater than 50.
