|
| 1 | +''' |
| 2 | +Hello and welcome to another python 3 basics video. |
| 3 | +
|
| 4 | +In this video we'll be discussing some of the basics to |
| 5 | +debugging. In my videos, I get a lot of questions for |
| 6 | +help where people have errors and are not sure what |
| 7 | +the problem is. If they used some extremely simple debugging, |
| 8 | +they'd realize how obvious the answer is. |
| 9 | +
|
| 10 | +Most of the time, the problem is a typo, followed closely by |
| 11 | +a misunderstanding of indentation and standards. |
| 12 | +
|
| 13 | +so standards how are how organize your code. With python, |
| 14 | +unlike most languages, you define blocks of code like |
| 15 | +functions by indentation. Most python editors will automatically |
| 16 | +indent for you where it is necessary. With this, if you are ever |
| 17 | +coding along and find python automatically indenting you where |
| 18 | +you don't think it should, this should raise a flag for you to |
| 19 | +figure out. |
| 20 | +
|
| 21 | +
|
| 22 | +(show a basic function... ) |
| 23 | +
|
| 24 | +There are some more in-depth common-issues that you'll |
| 25 | +find from time to time, you can find more debugging videos |
| 26 | +by searching for debuggin in my channel. For now I will just |
| 27 | +keep these ones basic. |
| 28 | +
|
| 29 | +The first error we'll discuss is the NameError: is not defined |
| 30 | +
|
| 31 | +''' |
| 32 | + |
| 33 | +''' |
| 34 | +As obvious as this might appear to you, this gets people amazingly |
| 35 | +frequently. Just learn to recognize the "is not defined" |
| 36 | +
|
| 37 | +chances are you typoed the definition of the variable or when you |
| 38 | +are referring to it. |
| 39 | +''' |
| 40 | +variable = 55 |
| 41 | +#print(varaible) |
| 42 | + |
| 43 | + |
| 44 | +''' |
| 45 | +Next up, we have indentation issues. |
| 46 | +
|
| 47 | +You will see "expected an indented block" as a |
| 48 | +popup when you never enter an indented block for |
| 49 | +something that requires it, like a function. |
| 50 | +''' |
| 51 | + |
| 52 | +''' |
| 53 | +def task1(): |
| 54 | +
|
| 55 | +
|
| 56 | +def task2(): |
| 57 | + print('more tasks') |
| 58 | +
|
| 59 | +''' |
| 60 | + |
| 61 | + |
| 62 | +''' |
| 63 | +unexpected indent... |
| 64 | +''' |
| 65 | + |
| 66 | +def task(): |
| 67 | + print ('stuff') |
| 68 | + |
| 69 | +print('more stuff') |
| 70 | + |
| 71 | + print('stuff') |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +''' |
| 76 | +EOL while scanning string literal |
| 77 | +''' |
| 78 | + |
| 79 | + |
| 80 | +def task(): |
| 81 | + print('some people find themselves committing this too |
| 82 | + |
| 83 | + |
| 84 | + print('ouch...') |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
0 commit comments