I think `if not (1 <= rating <= 7)` is more readable.