0
0
Drone Programmingprogramming~10 mins

Range finder for terrain following 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 read the distance from the range finder sensor.

Drone Programming
distance = sensor.[1]()
Drag options to blanks, or click blank then click option'
Ameasure
Bget_distance
Cread_distance
Dfetch
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method name that does not exist on the sensor object.
Confusing the method with one that sets values instead of reading.
2fill in blank
medium

Complete the code to check if the drone is too close to the ground.

Drone Programming
if distance [1] safe_height:
Drag options to blanks, or click blank then click option'
A<
B>=
C==
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>=' instead of '<' which reverses the logic.
Using '==' which only checks for exact equality.
3fill in blank
hard

Fix the error in the code to update the drone's altitude safely.

Drone Programming
drone.altitude [1] safe_height
Drag options to blanks, or click blank then click option'
A==
B-=
C+=
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which is a comparison, not assignment.
Using '+=' or '-=' which modifies the value instead of setting it.
4fill in blank
hard

Fill both blanks to create a dictionary of distances for each sensor if the distance is less than the threshold.

Drone Programming
distances = {sensor_id: [1] for sensor_id, [2] in sensors.items() if [1] < threshold}
Drag options to blanks, or click blank then click option'
Adistance
Bdistance_value
Dvalue
Attempts:
3 left
💡 Hint
Common Mistakes
Using inconsistent variable names causing errors.
Using the same variable name for both keys and values.
5fill in blank
hard

Fill all three blanks to filter sensors and create a dictionary with sensor names in uppercase and distances greater than minimum distance.

Drone Programming
filtered = { [1]: [2] for [3], [2] in sensor_data.items() if [2] > min_distance }
Drag options to blanks, or click blank then click option'
Asensor.upper()
Bdistance
Csensor
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing variable names causing confusion.
Not converting sensor names to uppercase.