Is this 'lack of energy' caused by diet or exercise?

Poor diet? It's hard to say without knowing if your diet is well balanced. If you're not getting enough protein you may feel tired. Exercise usually makes a person feel more energetic. If your lack of energy continues see your doctor. You might want to keep a food diary for 3 days so your doctor can see what you're eating.
Or hormone imbalance. Lack of energy is one of the main symptoms of hormone imbalance. However, it can be deconditioning - related to lack of exercise or improper nutrition.