Challenge - 5 Problems
Search and Rescue Drone Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Drone path calculation output
What is the output of this drone path calculation code snippet?
Drone Programming
def calculate_path(start, end): path = [] x, y = start ex, ey = end while x != ex or y != ey: if x < ex: x += 1 elif x > ex: x -= 1 if y < ey: y += 1 elif y > ey: y -= 1 path.append((x, y)) return path print(calculate_path((0, 0), (2, 1)))
Attempts:
2 left
💡 Hint
Trace the increments of x and y carefully in the loop.
✗ Incorrect
The code increments x and y towards the end point simultaneously. Starting at (0,0), x increments to 1 and y increments to 1, then x increments to 2 while y stays at 1, producing [(1,1), (2,1)].
🧠 Conceptual
intermediate1:30remaining
Understanding drone sensor data filtering
A drone receives noisy sensor data for temperature readings. Which method best filters out sudden spikes while keeping the trend smooth?
Attempts:
2 left
💡 Hint
Think about smoothing data to reduce noise.
✗ Incorrect
A moving average filter smooths out sudden spikes by averaging recent values, preserving the overall trend better than max or difference methods.
🔧 Debug
advanced1:30remaining
Fix the drone battery check logic
What error does this drone battery check code raise when battery_level is 15?
Drone Programming
battery_level = 15 if battery_level > 20: status = 'Full' elif battery_level > 10: status = 'Medium' else: status = 'Low' print(status)
Attempts:
2 left
💡 Hint
Check the syntax of the else statement.
✗ Incorrect
The else statement is missing a colon, causing a SyntaxError before the code runs.
❓ Predict Output
advanced2:00remaining
Drone search grid coverage count
What is the number of unique grid cells covered by the drone after this movement sequence?
Drone Programming
moves = ['N', 'N', 'E', 'E', 'S', 'W', 'W', 'N'] visited = set() x, y = 0, 0 visited.add((x, y)) for move in moves: if move == 'N': y += 1 elif move == 'S': y -= 1 elif move == 'E': x += 1 elif move == 'W': x -= 1 visited.add((x, y)) print(len(visited))
Attempts:
2 left
💡 Hint
Count each unique coordinate visited after each move.
✗ Incorrect
The drone visits these coordinates: (0,0), (0,1), (0,2), (1,2), (2,2), (2,1), (1,1). Total unique cells = 7.
🚀 Application
expert3:00remaining
Optimizing drone search pattern for battery life
Given a drone must search a rectangular area of 10x5 units and return to start, which path minimizes total distance traveled?
Attempts:
2 left
💡 Hint
Consider covering all cells efficiently without backtracking.
✗ Incorrect
Zigzag row-by-row covers all cells systematically with minimal overlap and shortest return path, optimizing battery use.