|
| https://realpython.com/ |
| Start Here | https://realpython.com/start-here/ |
|
Learn Python
| https://realpython.com/lessons/python-basics-code-bugs-summary/ |
| Python Tutorials →In-depth articles and video courses | https://realpython.com/search?kind=article&kind=course&order=newest |
| Learning Paths →Guided study plans for accelerated learning | https://realpython.com/learning-paths/ |
| Quizzes & Exercises →Check your learning progress | https://realpython.com/quizzes/ |
| Browse Topics →Focus on a specific area or skill level | https://realpython.com/tutorials/all/ |
| Community Chat →Learn with other Pythonistas | https://realpython.com/community/ |
| Office Hours →Live Q&A calls with Python experts | https://realpython.com/office-hours/ |
| Podcast →Hear what’s new in the world of Python | https://realpython.com/podcasts/rpp/ |
| Books →Round out your knowledge and learn offline | https://realpython.com/products/books/ |
| Reference →Concise definitions for common Python terms | https://realpython.com/ref/ |
| Code Mentor →BetaPersonalized code assistance & learning tools | https://realpython.com/mentor/ |
| Unlock All Content → | https://realpython.com/account/join/ |
|
More
| https://realpython.com/lessons/python-basics-code-bugs-summary/ |
| Learner Stories | https://realpython.com/learner-stories/ |
| Python Newsletter | https://realpython.com/newsletter/ |
| Python Job Board | https://www.pythonjobshq.com |
| Meet the Team | https://realpython.com/team/ |
| Become a Tutorial Writer | https://realpython.com/write-for-us/ |
| Become a Video Instructor | https://realpython.com/become-an-instructor/ |
| Search | https://realpython.com/search |
| https://realpython.com/search |
| Join | https://realpython.com/account/join/ |
| Sign‑In | https://realpython.com/account/login/?next=%2Flessons%2Fpython-basics-code-bugs-summary%2F |
| Unlock This Lesson | https://realpython.com/account/join/?utm_source=rp_lesson&utm_content=python-basics-code-bugs |
| Unlock This Lesson | https://realpython.com/account/join/?utm_source=rp_lesson&utm_content=python-basics-code-bugs |
| https://realpython.com/courses/python-basics-code-bugs/#team |
| Python Basics: Finding and Fixing Code Bugs | https://realpython.com/courses/python-basics-code-bugs/ |
| Martin Breuss | https://realpython.com/courses/python-basics-code-bugs/#team |
| Recommended Tutorial | https://realpython.com/python-debug-idle/ |
| Course Slides (.pdf) | https://realpython.com/courses/python-basics-code-bugs/downloads/python-basics-code-bugs-slides/ |
| Sample Code (.zip) | https://realpython.com/courses/python-basics-code-bugs/downloads/python-basics-code-bugs-code/ |
| Ask a Question | https://realpython.com/lessons/python-basics-code-bugs-summary/#discussion |
| https://realpython.com/feedback/survey/course/python-basics-code-bugs/liked/?from=lesson-title |
| https://realpython.com/feedback/survey/course/python-basics-code-bugs/disliked/?from=lesson-title |
| Contents | https://realpython.com/lessons/python-basics-code-bugs-summary/#description |
| Transcript | https://realpython.com/lessons/python-basics-code-bugs-summary/#transcript |
| Discussion (4) | https://realpython.com/lessons/python-basics-code-bugs-summary/#discussion |
| Unlock This Lesson | https://realpython.com/account/join/?utm_source=rp_lesson_preview&utm_content=python-basics-code-bugs |
| Sign-In | https://realpython.com/account/login/ |
| Unlock This Lesson | https://realpython.com/account/join/?utm_source=rp_lesson_preview&utm_content=python-basics-code-bugs |
| Sign-In | https://realpython.com/account/login/ |
| 00:00 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=0.51 |
| Congratulations. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=0.51 |
| You’ve made it to the end of this Python Basics course about finding and fixing | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=1.45 |
| code bugs. Did you see how you just fixed that code bug? Nice work. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=5.74 |
| 00:12 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=12.6 |
| While going through the lessons of this course, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=12.6 |
| you first learned about how to use IDLE’s Debug Control window, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=14.65 |
| and then you practiced debugging on a buggy function. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=18.53 |
| 00:23 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=23.26 |
| To get started with IDLE’s Debug Control window, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=23.26 |
| you first need to open it, and you can do that from the interactive window by | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=25.74 |
| going to the menu option Debug | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=30.08 |
| and then click Debugger. That opens up the Debug Control window. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=31.82 |
| 00:36 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=36.3 |
| And you will also see that there’s the string [DEBUG ON] displayed in the | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=36.3 |
| prompt of your interactive window. Once you see that, you know | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=41.19 |
| you’re good and you can get started debugging. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=44.63 |
| 00:49 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=49.34 |
| You then also learned about the user interface elements in IDLE’s, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=49.34 |
| Debug Control window. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=53.04 |
| You learned about the different buttons—Step, Out, Over, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=54.46 |
| Go, and Quit—of which Step is the one that goes line by line, Out | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=58.85 |
| takes you out of a function, Over steps over a certain function, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=63.8 |
| Go runs until the next breakpoint, and Quit stops the debugger without | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=68.69 |
| exiting the Debug Control window. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=73.22 |
| 01:16 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=76.69 |
| You learned about the four checkboxes on the top- | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=76.69 |
| right of the Debug Control window. Those are Stack, Locals, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=79.5 |
| Globals, and Source, of which three of those are directly related to | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=83.57 |
| a panel in the Debug Control window. Those are Stack, Locals, and Globals. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=88.54 |
| 01:33 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=93.64 |
| And you also learned about what you can see inside of these panels while you | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=93.64 |
| debug your program. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=97.81 |
| 01:41 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=101.09 |
| Then you learned about the four debugging steps. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=101.09 |
| You start by guessing where the bug is located. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=103.96 |
| Then you set a breakpoint and inspect the code. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=106.89 |
| You identify the error and attempt to fix it. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=110.16 |
| 01:52 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=112.88 |
| And then you repeat steps one to three until the error is actually fixed. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=112.88 |
| After going over these four steps in theory, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=118.18 |
| you also practiced them on a buggy program. And the buggy | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=121.11 |
| program you worked with had a function called add_underscores() that takes a | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=125.97 |
| string and should return a string with each character separated with | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=129.93 |
| underscores. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=133.6 |
| 02:14 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=134.55 |
| Instead, it only returned the final letter and an underscore. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=134.55 |
| So you went into this buggy program and worked on fixing it, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=139.46 |
| following the four steps, and you managed to debug it, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=143.12 |
| which means that the actual output was the same as the expected output, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=147.41 |
| and you have a non-buggy program at the end. Yay! Congratulations. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=152.05 |
| 02:38 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=158.59 |
| Finally also learned about print debugging, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=158.59 |
| which means adding print() calls to inspect variables at different states of your | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=161.17 |
| program. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=165.48 |
| And you learned that this can be useful in systems with limited resources, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=166.62 |
| for example IoT devices, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=170.97 |
| if they don’t have a debugger that’s available to you. However, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=173.13 |
| it means there’s more code to write for you. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=176.93 |
| 02:59 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=179.42 |
| It means that you always need to run the whole program to see the output. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=179.42 |
| And you also need to remember to remove the print() calls afterwards. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=183.54 |
| 03:06 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=186.82 |
| So if you can, use a debugger. While using IDLE’s debugger, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=186.82 |
| you might have noticed that you weren’t able to interact with the variables | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=191.37 |
| inside of your program. You were just able to view them. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=195.69 |
| 03:18 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=198.77 |
| Now there’s also something called interactive debuggers, and Python’s standard | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=198.77 |
| library comes with one of them and that one is called Pdb. Real Python has | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=202.5 |
| also resources on working with Pdb, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=207.37 |
| So if you’re interested in diving deeper into debugging, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=210.36 |
| check out this course on Python Debugging With Pdb | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=213.71 |
| 03:38 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=218.58 |
| and the associated tutorial that is also about debugging in Python using | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=218.58 |
| Pdb. And one final thing I want say: | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=223.7 |
| even though you can be harsh to bugs inside of your code, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=226.74 |
| and some people like to talk about squashing them, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=230.65 |
| just keep in mind that real-life bugs are actually really cute and you don’t want to | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=233.26 |
| hurt those. All right, | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=237.18 |
| thanks for joining me in this course on finding and fixing code bugs. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=239.21 |
| 04:03 | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=243.33 |
| I hope you learned something, and see you the next time. | https://realpython.com/lessons/python-basics-code-bugs-summary/#t=243.33 |
| Aug. 5, 2022 | https://realpython.com/lessons/python-basics-code-bugs-summary/#comment-1c94596b-5bf5-46ac-8a06-4d22da140088 |
| Aug. 5, 2022 | https://realpython.com/lessons/python-basics-code-bugs-summary/#comment-fbb52d04-9115-413b-9484-7e0011810f95 |
| Python Basics | https://realpython.com/products/python-basics-book/ |
| video courses | https://realpython.com/lessons/write-python-script/ |
| Aug. 6, 2022 | https://realpython.com/lessons/python-basics-code-bugs-summary/#comment-fbf55430-6a1d-4813-a7f1-eaa4d3590860 |
| Aug. 11, 2022 | https://realpython.com/lessons/python-basics-code-bugs-summary/#comment-4bd0ba04-0c8d-4ff5-867e-15a0e6153e8e |
| Become a Member | https://realpython.com/account/join/ |
| https://realpython.com/lessons/python-basics-code-bugs-quiz/ |
| Overview | https://realpython.com/courses/python-basics-code-bugs/ |
|
Python Basics: Finding and Fixing Code Bugs (Overview) 01:12
| https://realpython.com/videos/python-basics-code-bugs-overview/ |
|
IDLE's Debug Control Window 06:40
| https://realpython.com/videos/idle-debug-control/ |
|
The Step, Out, and Over Buttons 08:24
| https://realpython.com/lessons/step-out-over/ |
|
Breakpoints, Go, and Quit 04:44
| https://realpython.com/lessons/breakpoints-go-quit/ |
|
A Buggy Program 03:39
| https://realpython.com/lessons/buggy-program/ |
|
Step 1: Guess 02:04
| https://realpython.com/lessons/step-one-guess/ |
|
Step 2: Set a Breakpoint and Inspect 04:00
| https://realpython.com/lessons/step-two-breakpoint/ |
|
Step 3: Identify and Fix 01:27
| https://realpython.com/lessons/step-three-identify-fix/ |
|
Step 4: Repeat 02:32
| https://realpython.com/lessons/step-four-repeat/ |
|
Print Debugging 03:51
| https://realpython.com/lessons/print-debugging/ |
|
Python Basics: Finding and Fixing Code Bugs (Quiz) 04:30
| https://realpython.com/lessons/python-basics-code-bugs-quiz/ |
|
Python Basics: Finding and Fixing Code Bugs (Summary) 04:07
| https://realpython.com/lessons/python-basics-code-bugs-summary/ |
| Privacy Policy | https://realpython.com/privacy-policy/ |
Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover