Oh, teachers ... Being Swedish, I obviously know how to pronounce k by heart, but we were taught which vowels are soft (e, i , y, ä, ö) and which ones are hard (a, o, u, å), but never what it all was any good for. XD
The same rule applies for c and g btw. C is k before hard vowels and s before soft (but that's an international rule), g is g before hard vowels and j before soft. :)