There are 50 items of data, so the median is between the 25th and 26th datum (when they are ordered by weight) which are 5 and 5. The median weight is therefore 5 grams. The mean is 1 gram more, making it 6g. This means the total weight is 6×50=300g. (The median is the central value when the data are laid out in order:
2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, ... The median is in the group of 16 5’s.)
Now we find the sum of the data=2×4+4×7+5×16+x×10+9×13=
8+28+80+10x+117=300, 10x=300-233=67, so x=6.7g.