Python Jumpstart by Building 10 Apps Transcripts
Chapter: App 3: Birthday countdown app
Lecture: Summary and debugging with PyCharm
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Our app is finished, but let me show you a really cool feature a pie charm that's going to help you throughout this course and we can also use that to
0:08
review what we've created so it's good and to remain method here now when you're writing code, it doesn't always go as planned.
0:14
Sometimes you need tio inspected state and carefully look at what's happening a lot of times
0:20
you'll see people talking about the bugging Python code using command line to buggers and other
0:25
things like that, but we don't do that reason pie time what we can do is actually was just like click or right here in this what they call the gutter
0:31
and set a break point we could even set a couple of them one here and one there if we go up here and we pressed the bug not the play but
0:37
the bug it will actually run in the two bugger and notice it's kind of here and it's hit this breakdown and just stopped right?
0:45
So is sitting there waiting it would show us the variables that air there and stuff
0:48
like that when good are console and see the output like we saw before and we
0:52
can say step over this or we could step into this functional watch it go or we could step into on lee our code so what's the difference here like if we
1:01
were working with parameters and stuff like that. And they were being computed as part of this. But there be computed, say,
1:07
inside of the pipe on framework and not our code. That would just skip that step and go in there. And if you happen to be inside a function,
1:14
you couldn't get out of it from there. So let's, just step over this line that will go to the consul here. Step over. We see this,
1:22
you know, maybe we want to learn more about this get birthday apartment that was confusing so we could step into that.
1:27
And as we step down, you could see it, prints out a little bit and then asked us the question. So let's answer nineteen, seventy four now,
1:34
it's still in this line we've got a step let's. Say eight and one more step. All right, notice we've entered these three days here,
1:42
through values and to the right of the variable here. It's. Not that, but it's just cause the variable here it has years.
1:49
Nineteen, seventy four months, eight and day is one that's really cool? And if we go over to the to bugger,
1:54
we can actually see, like here are all the variables over here we can right click and weaken, say, set value we could set this back to july feeling
2:04
notice it changes color to say this is not the natural value this is like something
2:08
you've done to it we take one more step we now have our birthday and it
2:12
even shows the birthday that the date representation over here so that's pretty cool so let's
2:18
step along here see your birthday shows it right there do another step it shows what
2:23
today is like i said september eighth and let's go ahead and suppose we could step
2:29
in here i guess and watch this go all right well come step along you see there's our time delta if we look at the variable it says dt is a time
2:38
delta negative sixty nine days so we step along one more time and print out the
2:43
information and that is our app pretty cool let me show you that these could even
2:47
be a little more advanced if we'd right click on this i could say i want
2:50
the condition where a number of days that completion for the stuff right here that's awesome
2:57
okay this is equal to zero let me take away this break point notice that his
3:02
little question mark now so if i run this and i say nineteen seventy four for
3:07
this is not my birthday so this will not hit the break point now it didn't like that did it i guess i got to do that one later here we go
3:19
no, just. It just gives, tried over that break point and doesn't do anything because it's, not my birthday. But if we do it again,
3:25
i come down here and i enter the right day. Nine. Eight boom break point. So you can do a lot of cool stuff with this to bugger with these break
3:35
points, things like that. So i definitely encourage. You. Use this of leverages whenever you having problems with your code,
3:42
and it will help you understand it better by stepping through it.