By turning reading the laser values you can control better that the robot is really turning 90 degrees. The 270 is basically the laser rays that correspond to the side of the robot. To get that just divide the number of rays by 1/4 of 360 and you will have the quarters of the laser. But essentially, it is more or less the laser ray that corresponds to the side
I assume when the tutorial mentioned ray number 270, it meant ranges index 270, which is not either left or right of the robot according to the following information.
Here is the information about the laser scan. It shows that the degree range is [-pi, pi], 360 degree covering. We can calculate the number of index is int((angle_max-angle_min)/angle_increment), which is 720. As we know front direction points to the x-axis, which means 0 degree, and front_index = 0, therefore, right_index=180, and left_index=540, back_index=0 or 719.
I cannot see anything related to index 270.
In addition, I think it is better to calculate the index dynamically instead of always hard coding these numbers…
PS: we have learned OOP but all the solutions still use procedure-oriented programming and even global variables, which are not good practice.