0
0
Drone Programmingprogramming~20 mins

Pre-flight checklist automation in Drone Programming - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Pre-flight Automation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output of battery check function
What is the output of this pre-flight battery check function when battery level is 75%?
Drone Programming
def check_battery(level):
    if level < 20:
        return "Battery too low"
    elif level < 50:
        return "Battery low"
    else:
        return "Battery sufficient"

print(check_battery(75))
A"Battery critical"
B"Battery low"
C"Battery too low"
D"Battery sufficient"
Attempts:
2 left
💡 Hint
Think about the battery level ranges and which message matches 75%.
🧠 Conceptual
intermediate
1:30remaining
Understanding sensor status check
If a drone's sensor status is represented by a dictionary {'GPS': True, 'Camera': False, 'Lidar': True}, which sensor is NOT ready for flight?
ACamera
BGPS
CLidar
DAll sensors are ready
Attempts:
2 left
💡 Hint
True means ready, False means not ready.
🔧 Debug
advanced
2:00remaining
Identify the error in the checklist loop
What error does this code raise when running the pre-flight checklist loop? checklist = ['Battery', 'GPS', 'Camera'] for item in checklist print(f"Checking {item}...")
Drone Programming
checklist = ['Battery', 'GPS', 'Camera']
for item in checklist
    print(f"Checking {item}...")
ATypeError: 'list' object is not callable
BSyntaxError: expected ':' after for loop
CIndentationError: unexpected indent
DNameError: checklist is not defined
Attempts:
2 left
💡 Hint
Check the syntax of the for loop header.
📝 Syntax
advanced
2:30remaining
Correct dictionary comprehension for sensor readiness
Which option correctly creates a dictionary showing sensor readiness from a list of sensors with their status?
Drone Programming
sensors = [('GPS', True), ('Camera', False), ('Lidar', True)]
A{sensor: status for sensor, status in sensors if status == True}
B{sensor: status if status == True for sensor, status in sensors}
C{sensor: status for sensor, status in sensors if status}
D{sensor: status for sensor, status in sensors}
Attempts:
2 left
💡 Hint
Remember the syntax for filtering in dictionary comprehensions.
🚀 Application
expert
2:00remaining
Final checklist status after automation run
Given this automation code, what is the final value of the variable 'ready' after running? checklist = {'Battery': True, 'GPS': True, 'Camera': False, 'Lidar': True} ready = all(checklist.values()) # What does 'ready' hold?
Drone Programming
checklist = {'Battery': True, 'GPS': True, 'Camera': False, 'Lidar': True}
ready = all(checklist.values())
AFalse
BNone
CTrue
DRaises an error
Attempts:
2 left
💡 Hint
The all() function returns True only if all values are True.