Here's why:
* Right-hand rule: The direction of the magnetic field produced by a solenoid is determined by the right-hand rule. If you curl your right hand fingers in the direction of the current flowing through the solenoid, your thumb will point in the direction of the north pole.
* Current direction: If you reverse the direction of the current flowing through the solenoid, the direction of the magnetic field also reverses, effectively switching the north and south poles.
In summary:
* Clockwise current: North pole at the end where the current flows into the solenoid, south pole at the other end.
* Counter-clockwise current: North pole at the end where the current flows out of the solenoid, south pole at the other end.