Complete the code to initialize a drone swarm with 5 drones.
swarm = DroneSwarm([1])The swarm is initialized with 5 drones by passing 5 as the argument.
Complete the code to make all drones in the swarm take off.
swarm.[1]()The take_off method makes all drones in the swarm lift off the ground.
Fix the error in the code to command the swarm to move forward by 10 meters.
swarm.move([1]=10)
The parameter distance specifies how far the swarm should move forward.
Fill both blanks to create a dictionary that maps each drone's ID to its battery level if battery is above 20%.
battery_status = {drone.[1]: drone.[2] for drone in swarm if drone.battery > 20}Use id to get the drone's identifier and battery to get its battery level.
Fill all three blanks to filter drones with battery above 50%, map their IDs to their current altitude, and convert IDs to uppercase.
altitudes = {drone.[1]: drone.[2] for drone in swarm if drone.[3] > 50}We convert the drone ID to uppercase with id.upper(), get the altitude with altitude, and filter by battery level with battery.