A costume party is going on in a class of a few students. The average of the boys (b) is g and the average age of the girls (g) is b. If the average age of all of them including their class teacher who is 42 years old is b+g.

Can you find the value of b+g?

Solve My Math Problem

8

for b in range(1,99):
for g in range(1,99):
sum1=2*b*g+42
sum2=(b+g)*(b+g+1)
if(sum1==sum2):
print(b,g,sum1)

(b,g)=(3,5) => b + g=8