To calculate for the energy content of food you will just continue from the last help page in the previous question. The last page left off with the calculation of energy in joule or calories for the walnut, and you divided by a 1000 cal/kcal or 1000 J/kJ to convert your number into kilo. Remember this is what the units on the back of the package really are in.
The last thing is to compensate for the entire mass of a package. If you calculated the energy of one walnut which weighs only a gram or two than what would the energy be in the entire bag or one serving size? I think you get the drift and can come up with some way of calculating it. Check to see if it make sense from what you know about calories.