0
0
Drone Programmingprogramming~20 mins

Delivery drone concept in Drone Programming - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Delivery Drone Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1: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)
A65
B75
C85
D90
Attempts:
2 left
💡 Hint
Subtract the battery used for both legs from the total battery.
🧠 Conceptual
intermediate
1: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?
A
if package_delivered:
    print('Delivered')
else:
    print('In transit')
B
if package_delivered == False:
    print('Delivered')
else:
    print('In transit')
C
if package_delivered = True:
    print('Delivered')
else:
    print('In transit')
D
)'tisnart nI'(tnirp    
:esle
)'derevileD'(tnirp    
:dereviled_egakcap fi
Attempts:
2 left
💡 Hint
Check the condition and indentation carefully.
🔧 Debug
advanced
2: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)
ASyntaxError: invalid syntax
BNameError: name 'distance_to_return' is not defined
CTypeError: unsupported operand type(s) for +: 'float' and 'str'
DValueError: could not convert string to float
Attempts:
2 left
💡 Hint
Check the types of variables being added.
📝 Syntax
advanced
1:30remaining
Identify the syntax error in drone command function
Which option contains a syntax error in defining a function to start the drone?
A
def start_drone():
    print('Drone started')  # correct
B
def start_drone():
    print('Drone started')
C
)'detrats enorD'(tnirp    
:)(enord_trats fed
D
def start_drone:
    print('Drone started')
Attempts:
2 left
💡 Hint
Check the function definition syntax.
🚀 Application
expert
2: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?
A1.1666666666666667
B0.95
C0.75
D1.0
Attempts:
2 left
💡 Hint
Use time = distance / speed for each leg and add them.