text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
using the get student function but
4,477.4
3.839
rather than print student let's go ahead
4,479.52
5.119
and declare expecto patronum printing
4,481.239
6.521
out just that as pure text and now let's
4,484.639
5
go ahead and print out not the student
4,487.76
4.84
but rather the return value of their own
4,489.639
5
charm method Method All right so let me
4,492.6
3.92
go back down to my terminal window and
4,494.639
5.361
run python of student. and enter name
4,496.52
5.8
let's start with Harry he lives in
4,500
5.28
Gryffindor uh petronis is a stag and
4,502.32
6.44
let's see expecto patronum and of course
4,505.28
5.959
we see the Stag Emoji what about someone
4,508.76
4.439
like Draco who at least in the books
4,511.239
4.4
doesn't have a known Patronis well let's
4,513.199
4.201
go ahead and clear my terminal window
4,515.639
4.281
rerun python of student. py and this
4,517.4
5.319
time let's type in Draco for name
4,519.92
5.6
slyther in for house and Patronis is
4,522.719
4
unknown so I'm just going to go ahead
4,525.52
4.08
and hit enter and now expecto patronum
4,526.719
6.401
and just kind of sizzles instead well
4,529.6
7.2
let me propose now that we remove this
4,533.12
6.48
petronis code just to simplify our world
4,536.8
4.96
and focus on some of the other core
4,539.6
4.2
capabilities of classes so at the risk
4,541.76
3.6
of disappointing I'm going to get rid of
4,543.8
4.2
all of these beautiful emoji and charms
4,545.36
4.279
and I'm going to go ahead and stop
4,548
3.96
asking the user now for their petronis
4,549.639
4.441
and I'm going to stop passing it into in
4,551.96
4.84
it here and I'm going to stop uh doing
4,554.08
5.36
this here and I'm going to instead just
4,556.8
5.8
go ahead and restore our use of print
4,559.44
5.36
student here and I'm going to go ahead
4,562.6
4.52
and get rid of petronis down here so
4,564.8
4.52
essentially undo all of the fun charms
4,567.12
4.36
we just created so we're now back at the
4,569.32
5.879
point in the story where we have a
4,571.48
6.64
student class with only two methods in
4,575.199
5.44
it and stir the first of those takes of
4,578.12
4.24
course self as the first argument as it
4,580.639
4
always will plus two more now name and
4,582.36
4.6
house no more Patronis we're validating
4,584.639
4.761
name up here we're validating house down
4,586.96
4.199
here and then we're assigning name and
4,589.4
3.72
house respectively to two instance
4,591.159
4.401
variables called name and house also but
4,593.12
4.72
we used self to get access to the
4,595.56
4.4
current object to store those values
4,597.84
4.319
therein we then still have our stir
4,599.96
4.64
method here which takes one argument by
4,602.159
4.48
default self and that's it and that
4,604.6
3.28
function is going to be called
4,606.639
3.321
automatically anytime you want to
4,607.88
4.68
convert a student object to a string
4,609.96
5.199
just like print might want to do here so
4,612.56
4.079
let me go ahead and just make sure I
4,615.159
2.921
haven't broken anything let me run
4,616.639
4.08
python of studenty I'll type in Harry
4,618.08
5.36
I'll type in Gryffindor enter okay we're
4,620.719
4.721
back in business gone are the charms and
4,623.44
4.08
patronises but at least I'm back to a
4,625.44
4.68
situation where I have names and houses
4,627.52
5.76
but it turns out at the moment our use
4,630.12
6.68
of classes is not very robust even
4,633.28
6
though we have this mechanism very
4,636.8
5.32
cleverly if I may in our init method of
4,639.28
5.32
making sure that validating name and
4,642.12
4.96
house making sure that name is not blank
4,644.6
5.039
and making sure that house is a valid
4,647.08
5.639
house among those four Hogwarts houses
4,649.639
5.201
it turns out that classes will still let
4,652.719
4.081
me get at those attributes those
4,654.84
4.359
so-called instance variables using dot
4,656.8
5.16
notation anyway let me scroll down then
4,659.199
4.401
and try to do this a little
4,661.96
4.52
adversarially suppose that on line 16 I
4,663.6
4.92
go ahead and call get student which
4,666.48
4.679
exists as before and then I store the
4,668.52
4.8
return value in a student variable again
4,671.159
5.841
on line 16 that will ensure that get
4,673.32
6.04
student gets called which calls input
4,677
5.08
and input and then it calls the student
4,679.36
4.76
Constructor which invokes automatically
4,682.08
4.639
this init method so by way of how we've
4,684.12
5
laid out my code we're going to ensure
4,686.719
4.401
that name is not blank and house is
4,689.12
3.84
definitely one of those four values my
4,691.12
4.519
error correction or error checking is in
4,692.96
6.16
place but if I'm a little adversarial I
4,695.639
5.961
can still circumvent it suppose that
4,699.12
4.079
fine I'm going to you're going to
4,701.6
3
require me to type in Harry and
4,703.199
3.121
Gryffindor I'm going to go ahead and
4,704.6
3.88
type in student.h housee equals quote
4,706.32
5.44
unquote number four private drive and
4,708.48
4.92
you're not going to be able to stop me
4,711.76
4.36
why well it turns out with classes and
4,713.4
5.08
objects thereof you and I can still
4,716.12
4.4