Challenge - 5 Problems
Mission Simulation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of mission simulation with waypoint delays
What is the output of this drone mission simulation code snippet?
Drone Programming
mission = ['takeoff', 'waypoint1', 'waypoint2', 'land'] results = [] for step in mission: if step == 'takeoff': results.append('Taking off') elif step.startswith('waypoint'): results.append(f'Reached {step}') elif step == 'land': results.append('Landing') print(results)
Attempts:
2 left
💡 Hint
Look at how each mission step is checked and what is appended to results.
✗ Incorrect
The code checks each step and appends a descriptive string. For waypoints, it appends 'Reached' plus the waypoint name. So all steps are converted accordingly.
🧠 Conceptual
intermediate1:30remaining
Understanding simulation state updates
In a drone mission simulation, why is it important to update the drone's position state after each waypoint?
Attempts:
2 left
💡 Hint
Think about what position information helps with during flight.
✗ Incorrect
Updating position state allows the simulation to know where the drone is, which is essential for navigation, avoiding obstacles, and ensuring the mission follows the planned path.
🔧 Debug
advanced2:00remaining
Identify the error in mission simulation loop
What error will this mission simulation code produce when run?
Drone Programming
mission = ['takeoff', 'waypoint1', 'land'] for step in mission: if step == 'takeoff': print('Taking off') elif step.startswith('waypoint'): print(f'Reached {step}') elif step == 'land': print('Landing')
Attempts:
2 left
💡 Hint
Check the if condition syntax carefully.
✗ Incorrect
The if condition uses '=' which is assignment, not comparison. This causes a SyntaxError in Python.
📝 Syntax
advanced2:00remaining
Correct dictionary comprehension for mission status
Which option correctly creates a dictionary mapping each waypoint to its status 'pending' in a mission list?
Drone Programming
mission = ['takeoff', 'waypoint1', 'waypoint2', 'land']
Attempts:
2 left
💡 Hint
Remember the syntax for dictionary comprehensions with conditions.
✗ Incorrect
Option A uses correct syntax: {key: value for item in iterable if condition}. Others have syntax errors or wrong conditions.
🚀 Application
expert2:30remaining
Calculate total mission duration from simulation data
Given this simulation log of mission steps with durations in seconds, what is the total mission time?
Drone Programming
simulation_log = [
{'step': 'takeoff', 'duration': 5},
{'step': 'waypoint1', 'duration': 10},
{'step': 'waypoint2', 'duration': 15},
{'step': 'land', 'duration': 7}
]
total_time = sum(entry['duration'] for entry in simulation_log)
print(total_time)Attempts:
2 left
💡 Hint
Add all durations from each step in the log.
✗ Incorrect
Sum of durations: 5 + 10 + 15 + 7 = 37 seconds total mission time.