From my time in Southeastern Arizona where snakes and rattlesnakes especially are extremely common, people make what's called a snake wall which is basically a 18-24" rock wall all the way around the yard play area starting and ending at the house. It's usually made out of the local rock with vertical sides and mortar in between. There are typically several places where there are a couple of steep steps cut in so you can walk over but not compromise the effectiveness of the wall. The snakes can't climb the wall and you can generally make a snake free area for the kids. It works pretty well so long as you intelligently plan for drainage and the area is not so big that you can't check for animal holes periodically.
....
I suspect the wall works for poisonous snakes. As a kid I spent quite a bit of time looking at the snake enclosure at Gator Land. The enclosure was a wall, I think made from stucco and cinder blocks, maybe 3 feet tall. I remember having to use the steps they had to see over the wall.

Always wanted to take my kids to Gator Land but we never had the chance.

The snakes certainly did not climb out of that enclosure.
However, I have see a black snake climb a brick wall, move horizontally across that brick wall, and somehow climb up and off the roof. Danged thing was a Ninja.
I have not see a Rattlesnake on our place but we do have Copperheads. I hope the Turkeys and other critters keep the poisonous snake population down. I think I have seen more Black snakes than Copperheads and that is a good thing. I was walking to the tractor one day and hear a rattle. I stopped dead in my tracks for I did not want to be dead.

Looked down, and the rattler was a Black snake that was shaking it's tail against the leaf litter.

Other than eating some of our eggs when we had Chickens, I like the Black snakes and leave them alone, even when I know they are getting into song bird nests.