That code does not measure degrees, but intervals through your loop.
There are motor.rotateTo commands - they make your motor rotate to a specified degree based off of the motor’s IME.
Additionally, you can utilize the IME by itself by calling motor.position(degrees); , which will return the number of degrees that the motor has gone