Sometimes it is not possible for you to use a debugger. It may not be available, this is highly unlikely. So what do you do in this case? You can use print debugging. Print debugging is essentially using the print function to print portions of your code as it runs that way you can watch it run step by step and see exactly where it fails.
Ex:
var = 1 + 1
print(“Assigning value 1 + 1 to var variable”)
var = var -1
print(“Subtracting 1 from var”)
print(“Printing value of var”)
print(var)
Result:
Assigning value 1 + 1 to var variable
Subtracting 1 from var
Printing value of var
1
As you can see by using the print function for print debugging you can monitor each and every step of your program. Be sure to remove those print functions when you’re done. You probably don’t want the user to see your mess.
Another thing I would like note, always be sure to ask a friend or colleague for help with reviewing your code if possible. Also attempt to isolate problematic parts of your code as this can help you in identifying issues.