The energy of an electron may have discrete values - as when it is 'orbiting' the nucleus of an atom (the Hydrogen Atom is the example everyone starts with. Then it is part of a system, and not on its own.
If you have an electron in a dense material, where there are many atoms around it, then it may have a continuous range of energies (a 'band'). Also, when an electron is 'free' of any nearby charges, it can take a continuum of energy values. You can make it accelerate by giving it a circular path and it can radiate energy. This "synchrotron' radiation can have photons with a range of energies. This is 'classical behaviour' and, was one of the initial problems when trying to build a model of the atom involving orbiting electrons, which 'should' be radiating all the time, but they don't. It required quantum theory to sort it out.
So it is only when an electron has particular quantised energy states (in a system involving other charged particles) that the photons need to have fixed energies. (Each individual photon can, of course, only have one energy value).