Challenge - 5 Problems
Battery and Power Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateCalculate Remaining Battery Percentage
What is the output of this code that calculates the remaining battery percentage after a flight segment?
Drone Programming
battery_capacity = 5000 # in mAh used_capacity = 1250 remaining_percentage = (battery_capacity - used_capacity) / battery_capacity * 100 print(f"Remaining battery: {remaining_percentage:.1f}%")
Attempts:
2 left
💡 Hint
Remember to subtract used capacity from total capacity before calculating percentage.
✗ Incorrect
The remaining battery is calculated by subtracting used capacity (1250 mAh) from total capacity (5000 mAh), then dividing by total capacity and multiplying by 100 to get the percentage.
🧠 Conceptual
intermediateBattery Voltage and Power Output
If a drone battery outputs 11.1 volts and the drone consumes 20 amps, what is the power output in watts?
Attempts:
2 left
💡 Hint
Power (watts) = Voltage (volts) × Current (amps).
✗ Incorrect
Power is calculated by multiplying voltage (11.1 V) by current (20 A), which equals 222 watts.
🔧 Debug
advancedIdentify the Error in Battery Status Update Code
What error does this code raise when updating the battery status?
Drone Programming
battery_status = {'voltage': 11.1, 'current': 20}
# Update voltage
battery_status['voltage'] = 11.5
# Calculate power output
power_output = battery_status['voltage'] * battery_status['current']
print(power_output)Attempts:
2 left
💡 Hint
Check how dictionary keys are accessed in Python.
✗ Incorrect
Dictionaries require bracket notation for key access; dot notation causes AttributeError.
📝 Syntax
advancedFind the Syntax Error in Battery Check Function
Which option contains the correct syntax for this battery check function?
Drone Programming
def check_battery_level(level): if level < 20 return "Low battery" else: return "Battery OK"
Attempts:
2 left
💡 Hint
Remember to put a colon ':' after the if condition.
✗ Incorrect
Python requires a colon after the if statement and proper indentation for the return statements.
🚀 Application
expertCalculate Flight Time Based on Battery and Power Consumption
Given a drone battery capacity of 6000 mAh and an average current draw of 15 amps at 11.1 volts, what is the approximate flight time in minutes? (Assume 1 Ah = 1000 mAh and ignore efficiency losses.)
Attempts:
2 left
💡 Hint
Convert mAh to Ah, then divide capacity by current draw to get hours, then convert to minutes.
✗ Incorrect
6000 mAh = 6 Ah. Flight time (hours) = 6 Ah / 15 A = 0.4 hours = 24 minutes. Alternatively, battery energy = 11.1 V × 6 Ah = 66.6 Wh, power = 11.1 V × 15 A = 166.5 W, time = 66.6 / 166.5 = 0.4 hours = 24 minutes.
