0
0
Drone Programmingprogramming~20 mins

Speed control during mission in Drone Programming - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Speed Control Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this speed adjustment code?
Consider this snippet controlling drone speed during a mission. What will be printed?
Drone Programming
speed = 10
for waypoint in range(3):
    if speed > 5:
        speed -= 3
    print(f"Speed at waypoint {waypoint}: {speed}")
A
Speed at waypoint 0: 7
Speed at waypoint 1: 4
Speed at waypoint 2: 4
B
Speed at waypoint 0: 7
Speed at waypoint 1: 4
Speed at waypoint 2: 1
C
Speed at waypoint 0: 10
Speed at waypoint 1: 7
Speed at waypoint 2: 4
D
Speed at waypoint 0: 7
Speed at waypoint 1: 7
Speed at waypoint 2: 7
Attempts:
2 left
💡 Hint
Look carefully at how speed changes inside the loop and when it stops decreasing.
🧠 Conceptual
intermediate
1:30remaining
Which statement best describes speed control in a mission?
In drone programming, why is it important to adjust speed dynamically during a mission?
ATo avoid any speed changes to keep the mission predictable
BTo keep the drone always at maximum speed regardless of conditions
CTo save battery by flying slower when possible and faster when needed
DTo randomly change speed to confuse obstacles
Attempts:
2 left
💡 Hint
Think about energy use and mission efficiency.
🔧 Debug
advanced
2:00remaining
What error does this speed control code raise?
Identify the error when running this code snippet:
Drone Programming
speed = 5
for i in range(3):
    if speed < 10:
        speed += 2
    print(speed)
ASyntaxError due to missing colon after if statement
BTypeError because speed is an integer
CIndentationError due to print statement
DNameError because variable i is not used
Attempts:
2 left
💡 Hint
Check the if statement syntax carefully.
Predict Output
advanced
1:30remaining
What is the final speed after this mission segment?
Given this code controlling speed increments, what is the final speed printed?
Drone Programming
speed = 3
increments = [2, -1, 4, -3]
for inc in increments:
    speed = max(0, speed + inc)
print(speed)
A3
B5
C6
D4
Attempts:
2 left
💡 Hint
Add each increment carefully and ensure speed never goes below zero.
🚀 Application
expert
2:30remaining
How many speed changes occur in this mission code?
Count how many times the speed variable changes value during this mission segment:
Drone Programming
speed = 7
changes = 0
for step in range(5):
    new_speed = speed - step
    if new_speed != speed:
        speed = new_speed
        changes += 1
print(changes)
A2
B5
C3
D4
Attempts:
2 left
💡 Hint
Check each loop iteration and compare new_speed to current speed.