Since he scored a total of 31 points in the game
Since he scored p points in the second half
Since the total points = first half + second half, then
First + p = 31
The number scored in the first half = 31 - p
The expression is,
The score of the first part = 31 - p
Since he scored 7 points in the second half
That means p = 7
Then his score in the first part = 31 - 7 = 24
He scored 24 points in the first half