Challenge - 5 Problems
Pre-flight Automation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2: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))
Attempts:
2 left
💡 Hint
Think about the battery level ranges and which message matches 75%.
✗ Incorrect
The function returns "Battery sufficient" for levels 50 and above. Since 75 is above 50, it returns "Battery sufficient".
🧠 Conceptual
intermediate1: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?
Attempts:
2 left
💡 Hint
True means ready, False means not ready.
✗ Incorrect
The 'Camera' sensor has a value False, meaning it is not ready for flight.
🔧 Debug
advanced2: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}...")
Attempts:
2 left
💡 Hint
Check the syntax of the for loop header.
✗ Incorrect
The for loop is missing a colon ':' at the end of the line, causing a SyntaxError.
📝 Syntax
advanced2: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)]
Attempts:
2 left
💡 Hint
Remember the syntax for filtering in dictionary comprehensions.
✗ Incorrect
Option C correctly filters sensors with status True and creates the dictionary. Option C is invalid syntax, B is invalid, C includes all sensors regardless of status.
🚀 Application
expert2: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())Attempts:
2 left
💡 Hint
The all() function returns True only if all values are True.
✗ Incorrect
Since 'Camera' is False, all(checklist.values()) returns False, so 'ready' is False.