Day 13:100 Days Of Code

Day 13:100 Days Of Code

Python

How to find and fix the errors in your code:

It is very important part of the programmers life.

Here are 10 tips to handle bugs in your program.

  1. Describe the problem: Find what is the problem either it is unexpected output or throwing an error.
  2. Reproduce the bug: Change your program where it always throws that error.
  3. Play computer: Consider yourself as computer and see how computer is executing your problem.
  4. Fix the errors: Then fix it. Experience comes handy in debugging. You can be experienced by solving debugging problems on stackoverflow fro other peoples.
  5. Print is your friend: Use print() function often it really helps you in finding bugs in your code.
  6. Use a Debugger: Apart from print() function as your friend, use debuggers like Thonny and Python Tutor.
  7. Take a break: If you stared enough at your code then it's time to take a break or sleep. When you come back next time with fresh mind things will start working for you and you will notice it.
  8. Ask a friend: By asking your friend they could be programmer or the one who is learning along side with you might help because they will not make the same assumptions as you do.
  9. Run often: Try to run your code after writing each line of code so that you can find and fix bugs alongside instead of waiting and writing immense lines of code and then run by that way you will have number of bugs and you will not be able find where is where, and it will end up overwhelming.
  10. Ask stack overflow: If you are not able to pass through your bug by following above tips the go to stackoverflow and ask the developer community who is there to help, but make share that you faced very stranged and weird problem that nobody asked before in there.

Errors are good, and much easier to figure out than other programming problems(bugs: unexpected output)