I have an AQI air quality sensor, I want to output textual information about the state of the air depending on the data from the sensor.
Here’s what I’ve already done:

At the moment, the sensor shows status 59, which in theory should correspond to Moderate, but for some reason my code displays Harmful for sensitive groups

The in line comparison 51 >= aqi <= 100 is effectively the same as 51 >= aqi because there are no values between 51 and 100 that are less than or equal to 51. Following that logic, the first of your clauses that is true for the aqi value 59 is 101 >= aqi which corresponds to Harmful for sensitive groups.

51 >= aqi <= 100
but judging by the instructions, the sign >= if the left side is greater than or equal to the right side, on the left side there is 51, and on the right side I have the idea of the value of aqi, which is currently 59 51 <= aqi <= 100
and in your example <= if the left side is less than or equal to the right side

Or maybe I didn’t quite understand this instruction, what is being compared to what, can you explain a little more?

In-line comparison is the same as combining two comparisons with an AND operation.

I think it may be easier to see the difference between what the two version if we take each one and summarize it with the same frame of reference.

51 >= x <= 100
51 >= x AND x <= 100
x is less than or equal to 51 AND x is less than or equal to 100
This will only be true for values less than or equal to 51

51 <= x <= 100
51 <= x AND x <= 100
x is greater than or equal to 51 AND x is less than or equal to 100
This will be true for all values between 51 and 100

Oh, how, I understood the description in the instructions completely differently, or rather, everything is the other way around as it is.
Thank you very much for the detailed explanation.