when I enter
45 200
why I am getting no
and the reason is the if-else statement is coming false
but I don't know why
T = int(input("i"))
for _ in range(T):
X,Y = map (int, input().split(" "))
if Y in (X, X+200):
print("yes")
else:
print("no")
1 Answer 1
if Y in (X,X+200)
will check if Y
exists in the tuple consisting of the values X
and X+200
. You might be looking for the python range
function.
if Y in range(X,X+200)
should do what you need.
answered Jun 27, 2022 at 11:25
-
it is still not working in the problem > codechef.com/submit/ADVANCEnikhil0505– nikhil050506/27/2022 11:30:52Commented Jun 27, 2022 at 11:30
lang-py