Why are electromagnets used in electric appliances?