The getOrientation() method calculates the position of the Finch based on measurements taken by the accelerometer in the micro:bit. The accelerometer measures any force that causes acceleration in the x-, y-, or z-direction. Because the Finch is usually moving pretty slowly, the accelerometer mostly measures the acceleration due to gravity. When the Finch is sitting on a level surface, the acceleration due to gravity points through the base of the Finch, along the negative z-axis. If you instead position the Finch so that its beak is pointing at the sky, the acceleration due to gravity points along the positive y -axis. The accelerometer enables you to measure these differences.
The getAcceleration() method returns a three float values that measure the acceleration in m/s2 in the x-, y-, and z-directions; these values are roughly between -10 and 10. The code below stores the three values in variables with informative names.