Q:

How do I check if an int is between 0 and 3?

I have a script I want to print "x is equal to..." if x is between 0 and 3, and print "x is not equal to 0-3" if it is greater than 4 or lesser than 0. The way I have it right now though, it will print "x is equal to..." as long as x is less than 4, and will only print "x is not equal to 0-3" if it is greater than 4.
I am just beginning to learn python so I haven't really tried anything yet and wouldn't know where to begin.
This is the relevant code to the issue.
x = 0
if x < 4:
    print("x is equal to", x)
elif x < 4:    
    print("x is not equal to 0-3")

As you can see, as long as x is lower than 4 it will print "x is equal to...", when I want it to only print that if it is lower than 4 but higher than -1, and I also want it to print "x is not equal to 0-3" if it is less than 0.

A:

This should do the job quite nicely;
x = 0
if 0 <= x <= 3:
    print("x is equal to", x)
else:   
    print("x is not between 0 and 3")

You can also use the and operator, there is little to no difference between those examples but knowing that it exists is still worth.
if 0 <= x and x <= 3:
     print("x is equal to", x)
else:
     print("x is not between 0 and 3")

You can add as much and condition you want, and side note: the or operator also exists and can be useful.

