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.
Aucun commentaire:
Enregistrer un commentaire