When the magnet moves inside the ring, the magnetic flux penetrating the ring changes, which leads to the appearance of an induction current in the ring. The direction of the induction current is such that its magnetic field prevents a change in the external magnetic field, i.e. when the magnet is inserted into the ring, the magnetic field of the induction field is directed against the external magnetic field. Therefore, in this case, the ring is repelled from the magnet. When the magnet is pulled out, the induction current changes direction and its magnetic is now directed in the same way as the external magnetic field. Therefore, the ring is now attracted to the magnet.
Remember: The process of learning a person lasts a lifetime. The value of the same knowledge for different people may be different, it is determined by their individual characteristics and needs. Therefore, knowledge is always needed at any age and position.