Phrase learn something by experience, especially by an unpleasant experience
learned to swim the hard way
It was a big day for Bandar and Sukacita. The two Sumatran tiger cubs learned to swim the hard way—by getting dropped in the deep end!