Challenge - 5 Problems
Master of goto() Navigation
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of goto() with simple coordinates
What will be the output of this drone navigation code snippet?
Drone Programming
drone.goto(10, 20, 5) print(drone.position())
Attempts:
2 left
💡 Hint
The goto() command moves the drone to the specified x, y, z coordinates.
✗ Incorrect
The drone.goto(10, 20, 5) moves the drone to position (10, 20, 5). The position() method returns the current coordinates.
❓ Predict Output
intermediate2:00remaining
Effect of sequential goto() commands
What will be the drone's final position after running this code?
Drone Programming
drone.goto(5, 5, 5) drone.goto(10, 0, 0) print(drone.position())
Attempts:
2 left
💡 Hint
Each goto() command moves the drone to a new absolute position.
✗ Incorrect
The drone first moves to (5, 5, 5), then moves to (10, 0, 0). The final position is the last goto() coordinates.
🔧 Debug
advanced2:00remaining
Identify the error in goto() usage
This code is intended to move the drone to (10, 10, 10). What error will it cause?
Drone Programming
drone.goto(10, 10) print(drone.position())
Attempts:
2 left
💡 Hint
The goto() command requires three coordinates: x, y, and z.
✗ Incorrect
The goto() function expects three arguments. Providing only two causes a TypeError for missing the z coordinate.
🧠 Conceptual
advanced2:00remaining
Understanding relative vs absolute goto()
Which statement correctly describes the difference between absolute and relative goto() commands?
Attempts:
2 left
💡 Hint
Think about whether the drone moves to a fixed point or moves relative to where it is now.
✗ Incorrect
Absolute goto() uses fixed coordinates. Relative goto() moves the drone by adding offsets to its current position.
❓ Predict Output
expert3:00remaining
Output after complex navigation sequence
What is the final position printed by this code?
Drone Programming
drone.goto(0, 0, 0) drone.goto(5, 5, 5) drone.goto(5, 10, 5) drone.goto(10, 10, 10) print(drone.position())
Attempts:
2 left
💡 Hint
Each goto() sets the drone's position absolutely, not cumulatively.
✗ Incorrect
The drone moves step-by-step to each specified coordinate. The last goto() sets the final position.