Challenge - 5 Problems
Drone Communication Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Message Passing Output
What is the output of this drone communication code snippet?
Drone Programming
drone1 = {'id': 101, 'message': 'Hello'}
drone2 = {'id': 102, 'message': ''}
# drone2 receives message from drone1
drone2['message'] = drone1['message']
print(drone2['message'])Attempts:
2 left
💡 Hint
Think about how drone2 gets the message from drone1.
✗ Incorrect
The code assigns drone1's message to drone2's message, so drone2 prints 'Hello'.
🧠 Conceptual
intermediate1:30remaining
Communication Protocol Concept
Which communication protocol is best suited for drones to exchange short messages quickly and reliably over short distances?
Attempts:
2 left
💡 Hint
Think about short-range wireless communication.
✗ Incorrect
Bluetooth is designed for short-range, quick, and reliable wireless communication, ideal for drones nearby.
🔧 Debug
advanced2:30remaining
Fix the Drone Message Broadcast Bug
What error does this code raise when drones try to broadcast messages to each other?
Drone Programming
drones = [{'id': 1, 'msg': 'Hi'}, {'id': 2, 'msg': ''}]
for drone in drones:
for other in drones:
if drone != other:
other['msg'] = drone['msg']
print(drones[1]['msg'])Attempts:
2 left
💡 Hint
Check the dictionary keys used in the code.
✗ Incorrect
The key 'message' does not exist; the correct key is 'msg', so KeyError occurs.
📝 Syntax
advanced1:30remaining
Identify the Syntax Error in Drone Communication Loop
Which option contains the syntax error preventing the drone communication loop from running?
Drone Programming
for drone in drones print(drone['id'])
Attempts:
2 left
💡 Hint
Look for missing punctuation in the for loop.
✗ Incorrect
Option A is missing the colon ':' after the for statement, causing a syntax error.
🚀 Application
expert2:00remaining
Calculate Total Messages Exchanged
Given 4 drones where each drone sends a message to every other drone exactly once, how many total messages are exchanged?
Attempts:
2 left
💡 Hint
Each drone sends messages to all other drones except itself.
✗ Incorrect
Each of the 4 drones sends messages to 3 others, so 4 * 3 = 12 messages total.