My issue
BMC08 how is this question solved with out for loop
t = int(input())
for i in range(t):
A, B = map(int, input().split())
operation_num = 0
for j in range(A,B+1):
operation_num = operation_num +1
if A != B and operation_num%2==0:
A = A+2
elif A != B and operation_num%2 != 0:
A = A+1
if A==B:
print('YES')
break
elif A > B:
print('NO')
break
the above code is giving error
My code
# Update the code below to solve the problem
t = int(input())
for i in range(t):
A, B = map(int, input().split())
operation_num = 0
for j in range(A,B+1):
operation_num = operation_num +1
if A != B and operation_num%2==0:
A = A+2
elif A != B and operation_num%2 != 0:
A = A+1
if A==B:
print('YES')
break
elif A > B:
print('NO')
break
Learning course: Beginner DSA in Python
Problem Link: CodeChef: Practical coding for everyone