0
0
Drone Programmingprogramming~30 mins

Multi-drone coordination concept in Drone Programming - Mini Project: Build & Apply

Choose your learning style9 modes available
Multi-drone Coordination Concept
📖 Scenario: You are working with a fleet of delivery drones. Each drone has a unique ID and a current battery level. You want to coordinate which drones are ready to deliver packages based on their battery levels.
🎯 Goal: Build a simple program that stores drone data, sets a battery threshold, selects drones ready for delivery, and prints their IDs.
📋 What You'll Learn
Create a dictionary called drones with drone IDs as keys and battery levels as values
Create a variable called battery_threshold with a numeric value
Use a dictionary comprehension to create a new dictionary called ready_drones with drones having battery levels above the threshold
Print the list of drone IDs from ready_drones
💡 Why This Matters
🌍 Real World
Drone delivery companies need to manage many drones and decide which ones can fly based on battery levels to ensure safe and efficient deliveries.
💼 Career
Understanding how to filter and manage data collections is key for roles in robotics programming, drone fleet management, and automation.
Progress0 / 4 steps
1
DATA SETUP: Create the drone data dictionary
Create a dictionary called drones with these exact entries: 'droneA': 85, 'droneB': 40, 'droneC': 75, 'droneD': 30
Drone Programming
Need a hint?

Use curly braces {} to create the dictionary with keys and values separated by colons.

2
CONFIGURATION: Set the battery threshold
Create a variable called battery_threshold and set it to 50
Drone Programming
Need a hint?

Just assign the number 50 to the variable battery_threshold.

3
CORE LOGIC: Select drones ready for delivery
Use a dictionary comprehension to create a new dictionary called ready_drones that includes only drones from drones with battery levels greater than battery_threshold
Drone Programming
Need a hint?

Use {drone: battery for drone, battery in drones.items() if battery > battery_threshold} to filter drones.

4
OUTPUT: Print the IDs of ready drones
Print the list of keys from the ready_drones dictionary using print(list(ready_drones.keys()))
Drone Programming
Need a hint?

Use print(list(ready_drones.keys())) to show the drone IDs ready for delivery.