Many of you are very new to programming and want to jump right in to writing a bot, without having to spend too much time learning syntax, etc. You also may not have all the tools that an experienced programmer has, such as a debugger.
There are several types of bugs:
syntax errors: You left out a semicolon or closing brace, for example. When you get syntax errors in your programs, the compiler or interpretor will usually give you a file and line number of the problem and most of the times, tell you exactly what is wrong.
crashing bugs: You tried to print an undefined value, for example. Your application crashes at runtime and exits. You also usually get a file and line number, but the error may be more obscure.
obscure bugs: Sometimes you get a file and line number, but the bug happened earlier in the program and the line number you get is simply where it finally failed. For this type of bug, usually code worked earlier but it did something incorrectly or unexpectedly. For example, a string split created a string and empty string instead of two strings as you expected.
For this last type of bug, the best thing to do is work backwards from the line the program failed on. Pepper your code with print statements, print out the values of variables, see if you are getting what you expect to get, print out arguments to subroutines. As you go further back, eventually you will find the line that caused the bug. Fix that. Leave the print statements in. Make sure all the values are what you expect and then start to remove prints. You'll be surprised at how well this works. It may seem tedious, but it's actually very fast.
As you become more experienced, you'll realize it's a good idea to put prints in as you develop code so that you catch bugs early in the development process, rather than have dozens of bugs later.