Altogether, I have 10 bags of sweets.

The mean number of sweets in the bags is 40.
The table shows how many sweets there are in any 9 of the bags.

Number of sweets in a bag Frequency
39 = 2
40 =4
41 = 1
42 = 2
43 =0

How many sweets are there in the 10th bag?

AAAaannndd the bot gets it wrong yet again!

2*39 + 4*40 + 1*41 + 2*42 + x = 10*40
x = 37

41 sweets.