text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
we're returning that object to main so | 2,192.2 | 4.32 |
that we can actually print out who is | 2,194.52 | 3.839 |
from what house well let's go ahead and | 2,196.52 | 3.559 |
add a bit more functionality here | 2,198.359 | 4.041 |
because right now on lines 12 and 13 | 2,200.079 | 4.881 |
this is a little manual and it's a | 2,202.4 | 4.4 |
little reckless of me to just be putting | 2,204.96 | 4.639 |
anything I want inside of this student | 2,206.8 | 5.2 |
object it turns out with classes unlike | 2,209.599 | 4.121 |
with dictionaries we can actually | 2,212 | 3.92 |
standardize all the more what those | 2,213.72 | 5.04 |
attributes can be and how what kinds of | 2,215.92 | 5.04 |
values you can set them to so let me go | 2,218.76 | 4.52 |
ahead and do this let me propose that it | 2,220.96 | 5 |
would actually be really nice if instead | 2,223.28 | 5.68 |
of doing this here let me go ahead and | 2,225.96 | 5.08 |
simplify my code as follows let me go | 2,228.96 | 4.08 |
ahead and give myself a local variable | 2,231.04 | 3.52 |
called name and set it equal to the | 2,233.04 | 3.319 |
return value of input like we've done | 2,234.56 | 3.6 |
many times now already let me give | 2,236.359 | 3.561 |
myself one other variable for now called | 2,238.16 | 3.48 |
house and set it equal to the return | 2,239.92 | 4.12 |
value of input as well prompting the | 2,241.64 | 5.24 |
user for their house and now and instead | 2,244.04 | 5.16 |
of creating a student object from my | 2,246.88 | 5.479 |
student class and then manually putting | 2,249.2 | 5.72 |
the name attribute inside of it and the | 2,252.359 | 4.881 |
house attribute inside of it let me | 2,254.92 | 4.56 |
actually do something more powerful let | 2,257.24 | 5.119 |
me do this let me call that student | 2,259.48 | 5.44 |
function which is identical to the class | 2,262.359 | 5.081 |
name just by defining a class you get a | 2,264.92 | 5.08 |
function whose name is identical to the | 2,267.44 | 4.32 |
class name with the capital letter | 2,270 | 3.96 |
included but instead of just doing open | 2,271.76 | 4.44 |
parenthesis close parenthesis let me | 2,273.96 | 4.92 |
pass in the name that I want to fill | 2,276.2 | 5.32 |
this this object with and the house that | 2,278.88 | 4.68 |
I want to put in that object as well and | 2,281.52 | 3.68 |
now let me set the return value as | 2,283.56 | 5.96 |
before to be student equals like this so | 2,285.2 | 6.04 |
what have I done that's different | 2,289.52 | 3.079 |
fundamentally I'm still getting user | 2,291.24 | 3.24 |
input in the same way I'm using input on | 2,292.599 | 4.361 |
line 11 and input on line 12 and I just | 2,294.48 | 3.92 |
so happen to be storing those return | 2,296.96 | 4.28 |
values in local variables but now now | 2,298.4 | 4.24 |
we're setting the stage for the more | 2,301.24 | 3.879 |
powerful features of classes and | 2,302.64 | 3.959 |
objectoriented programming more | 2,305.119 | 3.441 |
generally notice that I'm deliberately | 2,306.599 | 4.881 |
passing to this capital S student | 2,308.56 | 6.16 |
function name comma house I'm passing in | 2,311.48 | 5.76 |
arguments to the function now the | 2,314.72 | 3.72 |
student class is not going to know what | 2,317.24 | 3.879 |
to do with those yet but now I'm sort of | 2,318.44 | 5.28 |
standardizing how I'm passing data into | 2,321.119 | 4.441 |
this student class and ultimately it's | 2,323.72 | 4.04 |
going to give me an opportunity to error | 2,325.56 | 3.84 |
check those inputs to make sure that the | 2,327.76 | 3.44 |
name is valid that it has a value and | 2,329.4 | 3.52 |
it's not just the user hitting enter | 2,331.2 | 3.32 |
it's going to allow me to ensure that | 2,332.92 | 3.64 |
it's a valid house that it's griffindor | 2,334.52 | 4 |
door or Hufflepuff or Ravenclaw or | 2,336.56 | 4.039 |
Slytherin or not just hitting enter or | 2,338.52 | 4.559 |
some random value that the user types in | 2,340.599 | 4.361 |
because I'm passing name and house to | 2,343.079 | 4.801 |
the student class this particular | 2,344.96 | 4.68 |
function I'm going to have more control | 2,347.88 | 3.92 |
over the correctness of my data so let's | 2,349.64 | 4.36 |
now go up to the student class which up | 2,351.8 | 4.64 |
until now I left as just dot dot dot it | 2,354 | 5.64 |
turns out that in the context of classes | 2,356.44 | 6 |
there are a number of not just uh | 2,359.64 | 4.719 |
attributes or instance variables that | 2,362.44 | 4.84 |
you can put inside but also method Me | 2,364.359 | 6.161 |
classes come with certain methods or | 2,367.28 | 5.559 |
functions inside of them that you can | 2,370.52 | 4.76 |
Define and they just behave in a special | 2,372.839 | 5.361 |
way by nature of how python works these | 2,375.28 | 5.4 |
functions allow you to determine | 2,378.2 | 4.56 |
behavior in a standard way they are | 2,380.68 | 4.56 |
indeed special methods in that sense now | 2,382.76 | 3.839 |
what do I mean by this well let me go | 2,385.24 | 4.16 |
back to VSS code here and let me propose | 2,386.599 | 5.76 |
that I start to define a standard | 2,389.4 | 6.08 |
function called uh underscore underscore | 2,392.359 | 5.921 |
or Dunder as it's abbreviated in it | 2,395.48 | 5.08 |
underscore underscore and then I'm going | 2,398.28 | 5.6 |
to go ahead and do open parenthesis and | 2,400.56 | 5.32 |
then I'm going to put in here literally | 2,403.88 | 3.84 |
the word self more on that in just a | 2,405.88 | 4.32 |
moment but now inside of this function | 2,407.72 | 5.119 |
I'm going to have an opportunity to | 2,410.2 | 6.919 |
customize this uh class's objects that | 2,412.839 | 6.52 |
is to say this underscore underscore | 2,417.119 | 5.681 |
init method or Dunder init method is | 2,419.359 | 5.881 |
specifically known as an instance method | 2,422.8 | 4.279 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.