Help me in solving LB01A problem

My issue

I wanna check if B is a floating value or not. If B is an integer it will return B or else -1

My code

# Step 1: Read and understand the problem statement and sample test cases

# Click on 'Next' once you are ready to proceed.
t=int(input())
for i in range(t):
    A, C=map(int, input().split)
    B=(A+C)/2
    if B==int:
        print(B)
    else:
        print(-1)

Learning course: Python for problem solving - 1
Problem Link: CodeChef: Practical coding for everyone

@priyanshux16
since u r taking average then the condition for having integer is if both A and C is even or odd else it would be -1

1 Like