"... valid range of 1 to 5"
"... valid range of 1 to 50"
Where do these come from? Those are not in the error messages.

In any case, your code has to make sure the input is valid, and warn the user if it is not.