My issue
Learning course: Python for problem solving - 1
Problem Link: CodeChef: Practical coding for everyone
Learning course: Python for problem solving - 1
Problem Link: CodeChef: Practical coding for everyone
You’re given two integers, A and C, and you need to find an integer B such that B is the average of A and C. In other words, B = (A + C) / 2.
All in all, the problem statement expects “-1”, in case the average of the given two integers can’t be an integer, this happens only when one of the given integers is odd, and the other is even.
Else, it expects the average of the two given integers.
Observation:
EVEN EVEN = AVG(A,C)
ODD ODD = AVG(A,C)
ODD EVEN = -1
EVEN ODD = -1