Answer: The degree of oxidation of an atom in a chemical compound is represented by its oxidation state.
Because each hydrogen in hydrogen peroxide gives up a single electron to oxygen, each hydrogen nevertheless retains an oxidation number of +1. Because each oxygen gains just one electron from its neighbouring hydrogen, oxygen has an oxidation number of -1.
Hydrogen has an oxidation number of +1 in water because it has lost one electron. Because the single oxygen atom has gained a total of two electrons, one from each hydrogen, oxygen has an oxidation number of -2.