That’s what this is all about. Amending one’s life and avoiding that sin.
An example would be the use of pornography. Amendment would include
Turning the computer around so that the entire family can see what you are perusing. Setting time limits on yourself on the use of the computer — in other words, not using it in the middle of the night. Canceling the channels that have pornography on them.
I think you get the idea. It takes action and a firm resolution of amendment for the sinner to avoid sins.
If one sins again, that is what is so wonderful about the Sacrament of Penance. He/She can avail themselves of the sacrament again and again.
But if God knows you are going o sin 3 weeks from now, how do you avoid it?