0
0
Drone Programmingprogramming~30 mins

Search and rescue assistance in Drone Programming - Mini Project: Build & Apply

Choose your learning style9 modes available
Search and Rescue Assistance
📖 Scenario: You are programming a drone to help in search and rescue missions. The drone needs to scan an area and identify locations where people might be trapped. Each location has a signal strength indicating the likelihood of a person being there.
🎯 Goal: Build a program that stores locations with their signal strengths, sets a threshold to decide which locations need rescue, filters those locations, and then prints the list of locations that require immediate attention.
📋 What You'll Learn
Create a dictionary called locations with exact keys and signal strength values
Create a variable called threshold with the exact value 70
Use a dictionary comprehension to create a new dictionary called rescue_needed with locations having signal strength greater than or equal to threshold
Print the rescue_needed dictionary
💡 Why This Matters
🌍 Real World
Drones help rescue teams by quickly identifying areas where people might be trapped using signal strengths or sensor data.
💼 Career
Understanding how to filter and process data is essential for programming drones and other autonomous devices in emergency response roles.
Progress0 / 4 steps
1
DATA SETUP: Create the locations dictionary
Create a dictionary called locations with these exact entries: 'Zone A': 65, 'Zone B': 80, 'Zone C': 55, 'Zone D': 90, 'Zone E': 40
Drone Programming
Need a hint?

Use curly braces {} to create a dictionary with keys as zone names and values as signal strengths.

2
CONFIGURATION: Set the signal strength threshold
Create a variable called threshold and set it to the integer 70
Drone Programming
Need a hint?

Just assign the number 70 to the variable threshold.

3
CORE LOGIC: Filter locations needing rescue
Use a dictionary comprehension to create a new dictionary called rescue_needed that includes only the locations from locations where the signal strength is greater than or equal to threshold
Drone Programming
Need a hint?

Use {zone: strength for zone, strength in locations.items() if strength >= threshold} to filter the dictionary.

4
OUTPUT: Print the rescue_needed dictionary
Write a print statement to display the rescue_needed dictionary
Drone Programming
Need a hint?

Use print(rescue_needed) to show the filtered dictionary.