Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start the drone's search mode.
Drone Programming
drone.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'land' instead of 'takeoff' will stop the drone immediately.
✗ Incorrect
The takeoff() command makes the drone start flying and begin the search.
2fill in blank
mediumComplete the code to check if the drone has found a person.
Drone Programming
if drone.detect_person() [1] True:
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' will check for no detection, which is wrong here.
✗ Incorrect
The condition == True checks if the drone detected a person.
3fill in blank
hardFix the error in the code to send a rescue signal when a person is found.
Drone Programming
if drone.detect_person() == True: drone.[1]('rescue_signal')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'receive' or 'wait' will not send the signal.
✗ Incorrect
The send() method is used to send signals like 'rescue_signal'.
4fill in blank
hardFill both blanks to create a dictionary of detected persons with their distances.
Drone Programming
detected = {person: drone.[1](person) for person in drone.[2]()} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'altitude' or 'battery_level' will not give correct distances or persons.
✗ Incorrect
The drone calculates distance with distance_to() for each person in detected_persons().
5fill in blank
hardFill all three blanks to filter persons within 100 meters and prepare rescue messages.
Drone Programming
close_persons = {person: dist for person, dist in detected.items() if dist [1] 100}
messages = [f"Rescue needed for [2] at [3] meters" for person, dist in close_persons.items()] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' will select persons farther than 100 meters, which is wrong.
✗ Incorrect
We select persons with distance less than 100 (<), then use person and dist to create messages.