0
0
Drone Programmingprogramming~10 mins

Testing failsafe scenarios 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 check if the drone battery is low.

Drone Programming
if battery_level [1] 20:
    initiate_landing()
Drag options to blanks, or click blank then click option'
A>
B<
C>=
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '<' causes the drone to land when battery is high.
2fill in blank
medium

Complete the code to retry connection if signal strength is weak.

Drone Programming
if signal_strength [1] 30:
    retry_connection()
Drag options to blanks, or click blank then click option'
A>=
B<=
C<
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>=' causes retry even when signal is strong.
3fill in blank
hard

Fix the error in the failsafe check for obstacle distance.

Drone Programming
if obstacle_distance [1] 5:
    stop_movement()
Drag options to blanks, or click blank then click option'
A<
B>
C==
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' causes the drone to stop when obstacle is far away.
4fill in blank
hard

Fill both blanks to create a failsafe that checks battery and signal before takeoff.

Drone Programming
if battery_level [1] 50 and signal_strength [2] 40:
    start_takeoff()
Drag options to blanks, or click blank then click option'
A>=
B<
C>
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' for battery_level causes takeoff with low battery.
5fill in blank
hard

Fill all three blanks to create a failsafe dictionary filtering sensors with safe readings.

Drone Programming
safe_sensors = {sensor: reading for sensor, reading in sensors.items() if reading [1] [2] and reading [3] 100}
Drag options to blanks, or click blank then click option'
A>=
B0
C<=
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '>=' excludes zero readings.