Why any other element except fluorine wouldn't take electrons from oxygen? My teacher said that fluorine is more electronegative than oxygen thus it will take electrons of oxygen. 

But now, why won't other Group 17 elements, like chlorine, bromine, iodine, would take electrons from oxygen? They too have just 7 electrons in their valence shells.

Technically, they should but yet they have lesser electronegativity and this is something that I'm not able to digest.
You can consider thinking about charge to volume density. Fluorine is very small and has highest charge to volume ratio among other group 17 elements. For that reason only fluorine is able to snatch electrons from oxygen.