Why is an electron not present within a nucleus?

When a nucleus is formed, the nucleons involved, that is, the protons and neutrons that are going to be forming the nucleus, are "squeezed" together in the fusion reaction. During this reaction, the stong interaction or strong nuclear force mediates the conversion of some of the mass of each proton and neutron that is going to make up the new nucleus into nuclear binding energy. The binding energy, or nuclear glue, is created from a bit of the mass of each nucleon involved through what is called mass deficit. If any electrons are present in the vicinity of the fusion reaction, they are "locked out" of the reaction by the strong interaction. The electron will not be permitted to become involved in the fusion reaction because it does not have the "right stuff" to participate. That is why no electrons can be in a nucleus. Note that in some kinds of nuclear decay called beta minus decay, an electron is created within the nuclues, and it is quickly ejected. The electron did not exist in that nucleus, but was created through the mediation of the weak interaction or weak nuclear force. A neutron was converted into a proton and an electron and an antineutrino, and then the electron was kicked out of the nucleus.