system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How do heat pumps work

How do heat pumps work and why are the energy efficient?

Edit: the question is sufficiently answered. Thanks guys!
gpt
You know those canned air bottles used for dusting? If you’ve ever used one you’ll know that at first the air comes out really fast, but then it drops off. Eventually the can gets really cold. When you set it aside you can hear a fizzing coming from it. What’s happening is that the liquid inside is under pressure and would really like to expand and be a gas. Letting it spray out allows more liquid to convert to a gas state, but in doing so heat leaves the liquid with the gas. The fizzing when you set it aside is the cold liquid inside boiling as it is heated by the air in the room. A heat pump basically works like that but in a closed loop with a compressor to re-pressurize the gas back into a liquid. Heat is carried from one side of this loop to the other. Refrigerators and AC units work in exactly the same way as a heat pump, the term “heat pump” generally refers to a unit that can pump heat in both directions, not just one.