Here we are with the little
for loop code snippet that we wrote before, and as with all the other examples, we want to check up on how does debugging work in here. On the left side, we have a couple of options that are part of this IDE by default, and one of them is the Debugger.
00:45 I can, again, step over, step into—let’s just do this. step into a bit and see what happens. We’re on line 2 now. Nicely highlighted in what’s the line that we’re currently at. And here’s our first printout!
01:35 So those are tradeoffs when working with an online environment like this. It obviously isn’t as feature-rich as some of the other options. It’s also probably going to be a bit slower because you’re running it over the internet through your browser instead of natively on your computer. Okay, I’m going to stop this debugger and show you a different way that you can also always debug if you want to interact with your variables, for example.
And now if I just normally execute my program—just run this. It’s going to stop at this point, where I put the breakpoint in there. And now I’m inside of my program. I can check the current variable—
x refers to
and now we’re at
1. So, this is just the default Python household debugger, and you can use it in here as well. If this debugger here doesn’t quite fulfill the needs that you have, just keep in mind that everything that’s part of Python is at your fingertips here as well.
So you do have debugging capabilities also in this online environment, and getting familiar with
pdb is going to be helpful both for your command line as well as for something like this. All right.
Become a Member to join the conversation.