Q:

Undesired output in C conditional statement

I have an assignment in class where I need to validate some user input and output different results based on said input. Very basic stuff, but I'm brand new to C, so this is where I'm starting. I thought I was on the right track, but regardless of what integer I input, the terminal prints Good job! Here is my code:
C
printf("How tall should the pyramid be?\n");
int n = GetInt();
if (3 <= n < 23)
{
    printf("Good job!\n");
}
else if (0 < n <= 3)
{
    printf("Well, that's not very impressive is it?\n");
}
else
{
    printf("Please enter a valid number between 1 and 23.\n");
}

Now, I have zero experience with C, but I do know some Python and if I were to translate the above code, it works as expected:
Python
n = input("Enter Number")
if (3 <= n < 23):
    print("Good job!\n")
elif (0 < n <= 3):
    print("Well, that's not very impressive is it?\n")
else:
    print("Please enter a valid number between 1 and 23.\n")

Why does this structure work in Python and not C? What should I change so that my C code will print the correct string?

A:

3 <= n < 23 does not work the way you think it does in C. First, n is compared with 3, then cast to integer, yielding 1 if true or 0 if false. Then 0 (or 1) is compared to 23, always yielding true (both are smaller than 23).
Rewrite it as 3 <= n && n < 23. Same applies to the other tests.

A:

3 <= n < 23

does not do what you think it does
It will do (3 <= n) which will evaluate to something (0 or 1 truth values maybe?) and then compare that to 23
you want
3 <= n && n < 23

Likewise 0 < n <= 3 becomes 0 < n && n <= 3

