Challenge - 5 Problems
Multi-Drone Coordination Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of drone position update loop
Consider a fleet of drones updating their positions in a loop. What is the output of the following code snippet?
Drone Programming
drones = [{'id': 1, 'pos': 0}, {'id': 2, 'pos': 5}]
for drone in drones:
drone['pos'] += 3
print([d['pos'] for d in drones])Attempts:
2 left
💡 Hint
Each drone's position increases by 3.
✗ Incorrect
The loop adds 3 to each drone's position. So 0 + 3 = 3 and 5 + 3 = 8.
🧠 Conceptual
intermediate1:30remaining
Understanding drone collision avoidance logic
In multi-drone coordination, what is the main purpose of a collision avoidance algorithm?
Attempts:
2 left
💡 Hint
Think about safety when multiple drones fly close.
✗ Incorrect
Collision avoidance algorithms help drones keep safe distances to avoid crashing into each other.
🔧 Debug
advanced2:30remaining
Identify the error in drone task assignment code
What error will this code produce when assigning tasks to drones?
Drone Programming
tasks = ['scan', 'deliver', 'survey'] drones = [{'id': 1}, {'id': 2}] for i in range(len(tasks)): drones[i]['task'] = tasks[i] print(drones)
Attempts:
2 left
💡 Hint
Check the loop range versus drones list length.
✗ Incorrect
The loop tries to assign a task to drones[2], but drones only has 2 elements (index 0 and 1), causing IndexError.
📝 Syntax
advanced2:00remaining
Syntax error in drone status update function
Which option contains the correct syntax for updating drone status in Python?
Drone Programming
def update_status(drone, status): drone['status'] = status return drone # Call example update_status({'id': 1}, 'active')
Attempts:
2 left
💡 Hint
Check function definition and dictionary assignment syntax.
✗ Incorrect
Option A uses correct function syntax and dictionary key assignment with '='.
🚀 Application
expert3:00remaining
Number of unique drone communication pairs
In a fleet of 6 drones, each drone communicates directly with every other drone exactly once. How many unique communication pairs are there?
Attempts:
2 left
💡 Hint
Use the formula for combinations of 6 items taken 2 at a time.
✗ Incorrect
The number of unique pairs is 6 choose 2 = 6*5/2 = 15.