Problem with decision trees exercise (information gain calculation)

I think there is a problem with exercise 2 on the Information Gain lesson of the Decision trees. https://www.codecademy.com/paths/machine-learning-fundamentals/tracks/mle-supervised-learning-i/modules/mle-decision-trees/lessons/mlfun-decision-trees/exercises/information-gain

The purpose of exercise 2 is to calculate the information gain at a certain split in the tree; however, the code that has to be uncommented does not calculate the information gain but the weighted gini impurity:

#2. Information gain at the ‘persons_2’ split
r_persons_2 = 604/912 #read ratio of the split from the tree!
gini_left_split = 0.434
gini_right_split = 0.0
gini_info_gain_persons_2 = r_persons_2gini_left_split + r_persons_2gini_right_split
print(f’Gini information gain node persons_2 : {gini_info_gain_persons_2}')

– > Gini information gain node persons_2 : 0.2874298245614035

If I understood well the explanations provided in the text (see link), the correct information gain would result from substracting the weigthed gini impurity after the split (.287) from the gini impurity before the split (.434):

Information gain for node persons_2 = 0.434 - 0.287 = 0.147

Am I perhaps missing anything? Could someone verify this? Many thanks

You can report course corrections and bugs here:

https://help.codecademy.com/hc/en-us/requests/new