Mothballs or napththaline may work as temporary snake repellent if that snake is living in a small space such as a shed or under the stairs. But there is no effective snake repellent that will work for wide open spaces like lawns.
If the snake is living in a confined space in the yard, mothballs can be placed in this space. When the snake is gone, find any openings that the snake used to get in and fill them.
Snakes live where food is nearby. Small snakes feed on insects while larger snakes feed on mice and rats. Unless the prey is eliminated, the snakes will keep coming back.
Mothballs can be hazardous if swallowed by wildlife, children or pets. Just the smell may make them vomit or have diarrhea. Pets and children need prompt medical attention for mothball poisoning.
Essential oils of cinnamon, clove and eugenol are more effective, safer snake repellents. The oil needs to be sprayed directly onto the snake in order for it to go away.