This unit is about, "putting it all together". We are going to start by looking at debugging using paper techniques and the built in debugger.
Sometimes, your code just doesn't do do what you want it to do.
A simple quick method is to use a print().
for i in range(0,5):
#do something cool, 5 times
How could I know if the loop actually ran 5 times?
I could use a simple print(i). By including that print() in the loop, I can see my variable change:
for i in range(0,5):
# do something cool, 5 times
print(i)
When I was sure that the loop was doing what I wanted, I would remove that line of code.
Debugging with print statements is a quick and common solution in all programming languages, but is there a better way?
IDEs (Integrated Development Environment) like IDLE have built in debuggers that help the programmer to trace code.