In J. K. Rowling’s Harry Potter and the Chamber of Secrets, upon confessing to Professor Albus Dumbledore, the headmaster of Hogwarts School of Witchcraft and Wizardry, that the Sorting Hat (a hat new students put on their head to determine which house they will be placed) only placed him in Gryffindor because he explicably asked not to be put in Slytherin, Harry was greeted by this reply from Dumbledore:
It is our choices, Harry, that show what we truly are, far more than our abilities.
And so it is. In this particular example, Dumbledore was telling Happy that he needn’t worry that he was only placed in Gryffindor (the arguably “good” house) instead of Slytherin (the inarguably “bad” house) because he asked not to be placed in the latter, because by asking not to be put in Slytherin he was making a choice to reject the bad in favor of the good.
Harry was aghast that the Sorting Hat had considered his qualities consistent with those who had been placed in Slytherin house before him, but his choice to reject these qualities is ultimately what showed him off for who he is; to his moral credit. ∎