📖 Scenario: Imagine you work for a company that uses drones to help farmers check their fields. Drones can fly over large areas quickly and collect important information like plant health and soil condition.
🎯 Goal: You will create a simple program that stores data about different fields and their health scores, then find which fields need attention based on a health threshold.
📋 What You'll Learn
Create a dictionary called fields with exact field names and health scores
Create a variable called health_threshold with the value 70
Use a dictionary comprehension to create a new dictionary fields_needing_attention with fields having health below the threshold
Print the fields_needing_attention dictionary
💡 Why This Matters
🌍 Real World
Drones help farmers by quickly checking large fields and identifying areas that need care, saving time and resources.
💼 Career
Understanding how to process and filter data collected by drones is useful for jobs in agriculture technology, environmental monitoring, and drone software development.
Progress0 / 4 steps
1
DATA SETUP: Create the fields data
Create a dictionary called fields with these exact entries: 'FieldA': 85, 'FieldB': 65, 'FieldC': 90, 'FieldD': 55
Drone Programming
Hint
Use curly braces {} to create a dictionary with field names as keys and health scores as values.
2
CONFIGURATION: Set the health threshold
Create a variable called health_threshold and set it to 70
Drone Programming
Hint
Just assign the number 70 to the variable health_threshold.
3
CORE LOGIC: Find fields needing attention
Use a dictionary comprehension to create a new dictionary called fields_needing_attention that includes only fields from fields with health scores less than health_threshold
Drone Programming
Hint
Use {field: health for field, health in fields.items() if health < health_threshold} to filter the dictionary.
4
OUTPUT: Show fields needing attention
Write a print statement to display the fields_needing_attention dictionary
Drone Programming
Hint
Use print(fields_needing_attention) to show the result.
Practice
(1/5)
1. Why are drones useful in industries like agriculture and construction?
easy
A. They can reach hard-to-access places quickly and safely.
B. They replace all human workers completely.
C. They only work indoors and need constant supervision.
D. They are very slow and expensive to operate.
Solution
Step 1: Understand drone capabilities
Drones can fly and reach places that are difficult or dangerous for people to access.
Step 2: Compare options
Options A, B, and C are incorrect because drones do not replace all workers, can work outdoors, and are designed to be efficient.
Final Answer:
They can reach hard-to-access places quickly and safely. -> Option A
Quick Check:
Drones reach tough spots = D [OK]
Hint: Think about where humans struggle to go safely [OK]
Common Mistakes:
Thinking drones replace all human jobs
Assuming drones only work indoors
Believing drones are slow and costly
2. Which of the following is the correct way to command a drone to take off in a simple drone programming language?
easy
A. takeoff()
B. fly.takeoff
C. start_fly()
D. drone fly()
Solution
Step 1: Identify correct function syntax
In most simple drone programming languages, commands are functions with parentheses, like takeoff().
Step 2: Check other options
Options A, B, and D are incorrect because they either miss parentheses or use wrong syntax.
Final Answer:
takeoff() -> Option A
Quick Check:
Function call syntax = takeoff() [OK]
Hint: Look for function calls with parentheses [OK]
Common Mistakes:
Missing parentheses in function calls
Using incorrect command names
Combining words without proper syntax
3. What will the following drone program output if it prints the drone's altitude after commands?
All commands have correct syntax; negative ascend reduces altitude, which is allowed.
Final Answer:
No error; program runs and prints altitude 2. -> Option B
Quick Check:
Negative ascend allowed = altitude 2 [OK]
Hint: Negative ascend changes altitude down, not error [OK]
Common Mistakes:
Thinking negative ascend causes error
Missing parentheses in commands
Assuming print syntax is wrong
5. You want a drone to survey a large farm by flying over 5 points and collecting data at each. Which programming approach best solves this efficiently?
hard
A. Fly randomly and hope to cover all points.
B. Write separate commands for each point manually.
C. Use a loop to fly to each point and collect data automatically.
D. Only collect data at the first point to save time.
Solution
Step 1: Understand the problem
Surveying multiple points requires repeating similar actions for each point.
Step 2: Choose efficient programming method
Using a loop automates flying and data collection at each point, saving time and reducing errors.
Final Answer:
Use a loop to fly to each point and collect data automatically. -> Option C
Quick Check:
Loop automates repeated tasks = A [OK]
Hint: Loops repeat tasks efficiently [OK]
Common Mistakes:
Writing repetitive manual commands
Flying randomly without control
Skipping data collection points
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.