Parts of a power supply:
A power supply gives the proper voltage and current for the electronic apparatus. Most power supplies consist of many stages, always in same order.
Figure-- Block diagram of a power supply. Sometimes a regulator is not required.
First, the alternating current encounters a transformer which steps the voltage either down or up, depending on exact requirement of the electronic circuits.
Second, the alternating current is rectified, so that it becomes pulsating direct current with the frequency of either 60 Hz or 120 Hz. This is always done by one or more semiconductor diodes.
Third, the pulsating direct current is filtered, or smoothed out, such that it becomes a continuous voltage having positive or negative polarity with respect to the ground. Finally, the direct current voltage might need to be regulated. Some equipment is fastidious, insisting on the right amount of voltage all the time. Other devices can put up with voltage changes.
Power supplies which provide more than a few volts should have features which protect the user from receiving a dangerous electrical shock. All the power supplies need fuses or circuit breakers to minimize fire hazard in case equipment shorts out.