Artificial intelligent assistant

How do tire pumps work? How does a pump push air into the tire and take in air from somewhere else? Why doesn't air spill out from the edges of the hole where the long thing goes in and out of the tube? I'm a complete noob to pumps.

Someone made a nice video.

There is a rubber seal around the piston which makes it air-tight with the inside of the cylinder. Then there are two check valves which only let the air flow in one direction: one to allow outside air in when you pull (but not let is out when you push), and one to let the high pressure air inside your tyre (but not let it out).

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 1c65944b45f89b5d54672157a86a4088