Step 3: Identify and Fix
00:00
In the previous lesson, you set a breakpoint and started debugging your code using the IDLE debugger. In this lesson, you will identify what the error is and try to make a change to see whether you can fix it. Now, you’ve figured out that something’s happening in here when instead of adding to the new_word
variable, you are actually replacing it. So at this point, you can conclude that this is what’s happening: instead of concatenating the string, you are replacing the string.
00:31
And since there’s only one line inside of your for
loop, you can conclude that the error lies on line 4. Now go ahead and stop your debugger by pressing Quit,
00:43 but don’t close the window yet. Keep it open because it will start the debugger again in just a second.
00:50
It’s time to apply a fix to the problem that you’ve identified. Instead of replacing new_word
with the current character and an underscore, you want to replace it with the current value of new_word
, plus the character plus an underscore.
01:08 So at this point, you’ve identified the problem and you’ve applied a fix to it. You hope that it’s a good fix that will actually take care of the bug that you had in the program before. But in order to know for sure, you will have to advance to step number four of your debugging process, which you will do in the next lesson.
Become a Member to join the conversation.