Things you can do to help prevent viruses from getting in your computer
For most people, these methods that will be listed are going to be obvious.
Ways you can keep viruses at bay:
Update your computer as soon as a new update is available (This will keep your computer up to date with the latest security fixes).
Install trusted antivirus programs.
Do not click on ads from sites.
Do not download files from sketchy or unsecured sites.
Run antivirus scans frequently.
Disclaimer: These tips are not guaranteed to keep your computer virus-free but they will help with that.