The drone starts at position (0, 0) facing north. It executes these commands in order:
- Move forward 5 meters
- Move right (lateral) 3 meters
- Move backward 2 meters
What is the drone's final position (x, y)?
position = [0, 0] # Facing north means y increases when moving forward position[1] += 5 # forward 5 position[0] += 3 # right 3 (lateral) position[1] -= 2 # backward 2 print(tuple(position))
Remember: forward/backward affect y-axis, lateral movement affects x-axis.
Starting at (0,0), moving forward 5 increases y to 5. Moving right 3 increases x to 3. Moving backward 2 decreases y to 3. Final position is (3, 3).
The drone is facing north. Which command moves it 4 meters to the left (lateral movement)?
Lateral movement means side to side, not forward or backward.
Moving left 4 meters moves the drone laterally to the left relative to its facing direction.
The drone is facing east. The code below is supposed to move the drone forward 6 meters, then left 2 meters. What error will occur?
position = [0, 0] # Facing east means x increases when moving forward position[0] += 6 position[1] += 2 # move left print(tuple(position))
Check how coordinates change when facing east.
Facing east, moving forward increases x. Moving left means moving north, increasing y since y axis increases north. The code correctly increases y by 2. No syntax or type errors occur.
Which code snippet will cause a syntax error when moving the drone forward 3 meters?
Look carefully at the spacing in the operators.
Option A has a space between '+' and '=', which is invalid syntax in Python.
A drone executes these lateral movements in order: right 5 meters, left 3 meters, right 2 meters, left 4 meters. What is the total lateral distance from the starting point?
Sum right movements and subtract left movements to find net lateral distance.
Total right = 5 + 2 = 7 meters; total left = 3 + 4 = 7 meters; net lateral distance = 7 - 7 = 0 meters. But since left and right cancel, the drone ends up at starting lateral position, so distance is 0 meters.
