Electric golf carts are powered by battery cells. Most carts are 36-volt or 48-volt but some now use zero maintenance lithium batteries. The batteries need to be regularly recharged to keep the cart on the road.
Gas powered golf carts run on small combustion engines. These engines are usually four-stroke, but some older golf carts might use two-stroke motors. They use gas like your truck or car would use for power.