Some snakes, such as pythons and boa constrictors, have small, vestigial legs beneath their skin and tiny, claw-like spurs on each side of the cloaca, which include the remnants of what used to be leg bones. Male snakes use these spurs during courtship and for fighting, but not for locomotion.
Fossil evidence suggests that snakes may have evolved from burrowing lizards. Hunting in tiny burrows and tunnels would have favored streamlined animals, with narrow pelvic bones and smaller legs. Eventually, legs would have been more of a hindrance than an advantage. There is dispute in the scientific community about whether snakes evolved from terrestrial lizards or marine reptiles, but the evidence clearly indicates that proto-snakes had legs.