Challenge - 5 Problems
Delivery Drone Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate1:30remaining
Calculate remaining battery after delivery
A delivery drone starts with 100% battery. It uses 15% battery to fly to the destination and 10% to return. What is the remaining battery percentage after the round trip?
Drone Programming
battery = 100 used_to_destination = 15 used_to_return = 10 remaining_battery = battery - used_to_destination - used_to_return print(remaining_battery)
Attempts:
2 left
💡 Hint
Subtract the battery used for both legs from the total battery.
✗ Incorrect
The drone uses 15% + 10% = 25% battery. Starting from 100%, remaining is 100 - 25 = 75%.
🧠 Conceptual
intermediate1:30remaining
Identify the drone's delivery status
The drone has a variable 'package_delivered' that is True if the package is delivered, False otherwise. Which code snippet correctly prints 'Delivered' when the package is delivered and 'In transit' otherwise?
Attempts:
2 left
💡 Hint
Check the condition and indentation carefully.
✗ Incorrect
Option A uses correct syntax and indentation. Option A reverses the logic. Option A uses assignment (=) instead of comparison (==). Option A has wrong indentation causing syntax error.
🔧 Debug
advanced2:00remaining
Fix the drone's flight path calculation error
The drone's flight path distance is calculated by adding the distances to destination and back. The code below has a bug. What error does it raise?
Drone Programming
distance_to_destination = 12.5 distance_to_return = '12.5' total_distance = distance_to_destination + distance_to_return print(total_distance)
Attempts:
2 left
💡 Hint
Check the types of variables being added.
✗ Incorrect
Adding a float and a string causes a TypeError because Python cannot add different types directly.
📝 Syntax
advanced1:30remaining
Identify the syntax error in drone command function
Which option contains a syntax error in defining a function to start the drone?
Attempts:
2 left
💡 Hint
Check the function definition syntax.
✗ Incorrect
Option D misses parentheses after function name, causing a syntax error.
🚀 Application
expert2:30remaining
Calculate total delivery time with variable speeds
A drone flies to a destination 20 km away at 40 km/h and returns at 30 km/h due to wind. What is the total flight time in hours?
Attempts:
2 left
💡 Hint
Use time = distance / speed for each leg and add them.
✗ Incorrect
Time to destination = 20/40 = 0.5 hours; time to return = 20/30 ≈ 0.6667 hours; total ≈ 1.1667 hours.