Your teacher was a good teacher. Yes, it is better formal style to write the word when the number is small and the word manageable-- up to 'twelve', I tell students. Also, any number at the beginning or end of the sentence should be written out, for obvious reasons: 'I was only 12.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.