Sunteți pe pagina 1din 2

Lesson 13 Debugging & BIFs

Debugging
1)
2)
3)
4)

Recognize the bug


Determine TYPE of bug
FIND the bug
CRUSH THE BUG

Syntax Errors
-

Python IDLE will tell us where to look

How do we fix them?


-

Find the correct syntax via Python Documentation or Google

Common examples:
-

Incorrect indentation
Missing colons ( : )
Missing parenthesis ()

Conceptual and Other errors


How do we find them?
Program yields unexpected results
How do we fix them?
-

Find the source of error by tracing thru program & adding print
statements to program if necessary.
Restructure algorithm

Common examples:
-

Incorrect if-statements
Infinite loops
Incorrect/Problem for algorithm

Resources
Python documentation

Advantages
-

Thorough explanation of EVERYTHING Python


Can find ALL possible approaches to a particular problem

Disadvantages
-

Can be difficult to understand

Google
Advantages
-

Quick and dirty solution to a problem


Useful for quick syntax fixes

Disadvantages
-

Solution may not be BEST solution


Information limited to what users contribute
(Especially on stackoverflow)

BIFs (Built-in Functions)


E.g print, reversed, sum, round etc.

We can learn about BIFs from:


-

Python Documentation
Google

Important to note:
-

Input parameters and types


Return types

S-ar putea să vă placă și