0
0
Drone Programmingprogramming~10 mins

Distributed task allocation in Drone Programming - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to assign a task to a drone.

Drone Programming
drone.task = [1]
Drag options to blanks, or click blank then click option'
Asurvey_area
B"survey_area"
Ctask_survey
Darea_survey
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put quotes around the task name.
Using undefined variable names.
2fill in blank
medium

Complete the code to check if the drone is available for a new task.

Drone Programming
if drone.status == [1]:
Drag options to blanks, or click blank then click option'
A"busy"
Bidle
Cready
D"available"
Attempts:
3 left
💡 Hint
Common Mistakes
Using status values without quotes.
Using incorrect status strings.
3fill in blank
hard

Fix the error in the code to add a task to the drone's task queue.

Drone Programming
drone.tasks.[1]("inspect_building")
Drag options to blanks, or click blank then click option'
Aappend
Badd
Cinsert
Dpush
Attempts:
3 left
💡 Hint
Common Mistakes
Using add() which is for sets, not lists.
Using push() which is not a Python list method.
4fill in blank
hard

Fill both blanks to create a dictionary of tasks assigned to drones with priority filtering.

Drone Programming
assigned_tasks = {drone.id: task for drone, task in task_list if task.priority [1] 5 and drone.status == [2]
Drag options to blanks, or click blank then click option'
A>
B==
C<
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using < instead of > for priority filtering.
Using != instead of == for status check.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps drone names to their current task if the task is urgent.

Drone Programming
urgent_tasks = {drone.[1]: drone.[2] for drone in drones if drone.task.[3] == True}
Drag options to blanks, or click blank then click option'
Aname
Bcurrent_task
Cis_urgent
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'status' instead of 'is_urgent' to check urgency.
Using wrong attribute names for drone or task.