Complete the code to define a mesh network node that can connect to multiple neighbors.
node = MeshNode(connections=[1])Mesh nodes connect to multiple neighbors to create a network where data can hop between devices.
Complete the code to send a message through the mesh network.
mesh.send_message(destination=[1], message='Hello')
Messages are sent to a specific device identified by its ID in quotes.
Fix the error in the code to correctly add a new node to the mesh network.
mesh.add_node([1])Adding a node requires creating a Node object with its ID.
Fill both blanks to create a function that checks if a node is reachable in the mesh network.
def is_reachable(node_id): return node_id [1] mesh.nodes and mesh.nodes[node_id].status [2] True
The function checks if the node ID is in the mesh nodes and if its status is True (reachable).
Fill all three blanks to create a dictionary comprehension that maps node IDs to their signal strength if above a threshold.
strong_signals = {node_id: mesh.nodes[node_id].[1] for node_id in mesh.nodes if mesh.nodes[node_id].[2] [3] 50}This comprehension collects signal strengths for nodes with strength greater than 50.
