Evolution has yielded tremendous biodiversity, proof that there's no one right answer. But occasionally, life's challenges inspire the evolution of the same solution — over and over and over again.

According to a new survey of spitting cobras, published Thursday in the journal Science, the deadly snakes have evolved the same instantly painful venom on three different occasions.

This example of convergent evolution, scientists argue, offers proof that spitting cobras evolved their venom for defensive purposes, undermining theories that snakes exclusively develop venom for predation.

All spitting cobras use a similar delivery mechanism to spray venom at distances of up to eight feet. The snakes aim their instantly-painful venom at the eyes of potentially threatening creatures.

"Here's a further strong piece of evidence to illustrate that similar evolutionary challenges often generate the same solutions," study co-author Wolfgang Wüster said in a news release.

"Even though we studied three different cobra groups, which evolved in different locations and at different evolutionary time periods, each evolved the same defensive mechanisms in the face of a threat," said Wüster, a researcher at Bangor University in Wales.

All cobras use venoms featuring cytotoxins, which destroy tissue, but spitting cobras mix in another class of toxins called phospholipases A2.

The synergy between the two types of toxins caused the venom to be instantly painful. When sprayed in a threat's eyes, it not only hurts, but can cause blindness.

For the study, researchers traced back the lineages of different spitting cobra groups to find the origins of the defensive technique. The analysis showed the strategy emerged among three different groups that evolved in different geographic locations.

Researchers found spitting cobras proliferated around the time humans show up in the fossil record.

"Many primates attack snakes with sticks and stones," Wüster said. "The arrival of bipedal hominins, with both hands free for mischief, may have been just the kind of selection pressure that favored long-distance defense through spitting and a specially adapted defensive venom."

"The idea that early humans, millions of years ago, may have caused the evolution of spitting in cobras emphasizes how our origins were very much entwined with the wider ecosystems of Africa and Asia at the time," Wüster said.