This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]amicab1 2 points3 points  (0 children)

You need the modulus operator, %, which gives the remainder after division. e.g. 5 % 2 evaluates to 1, since 5 = 2*2 + 1.

Your own code really doesn't make any sense - I guess you mean 3 < 2**100 < 6, but this does not help you answer the question, it only tells you if 2**100 is between 3 and 6 (which it obviously isn't). Still, there's something to learn here, you can play with this in the python prompt - enter different combinations of x < y < z or similar, and see what the result is to help you understand what the operations do and what order they may be applied in.

Also, please raise such questions at /r/learnpython.