text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
dict objects and that's for a reason | 6,171.599 | 5.12 |
dict itself is a class in Python if you | 6,174.52 | 4.679 |
pull up its official documentation here | 6,176.719 | 4.96 |
and you'll see that it is defined indeed | 6,179.199 | 4.881 |
as itself a class and that class comes | 6,181.679 | 4 |
with methods as well and so anytime | 6,184.08 | 3.44 |
we've manipulated dictionaries we've | 6,185.679 | 4.881 |
been in underneath the hood using all of | 6,187.52 | 4.84 |
those same methods and in fact we can | 6,190.56 | 3.84 |
see this if we're really curious let me | 6,192.36 | 5.2 |
go back over here to VSS code and let me | 6,194.4 | 5.04 |
go ahead and create a new file that very | 6,197.56 | 3.92 |
simply does something like play around | 6,199.44 | 3.679 |
with data types and let me go ahead and | 6,201.48 | 3.92 |
create a new file for instance called | 6,203.119 | 5.801 |
say uh type. piy just so that I can poke | 6,205.4 | 6.199 |
around inside of some values and in | 6,208.92 | 4.64 |
type. pi I'm just going to go ahead and | 6,211.599 | 4.12 |
do this I'm going to print out whatever | 6,213.56 | 5.079 |
the type is of say the number 50 and | 6,215.719 | 4 |
this is a function you've not | 6,218.639 | 3.121 |
necessarily seen me use already and it's | 6,219.719 | 4.121 |
not one you would frequently use in your | 6,221.76 | 3.959 |
own code there are other ways to te | 6,223.84 | 3.64 |
detect if you need to what the type is | 6,225.719 | 5.041 |
of a variable but in this case type of | 6,227.48 | 5.679 |
50 is just going to tell me and then | 6,230.76 | 4.359 |
print out what the data type is of that | 6,233.159 | 3.881 |
value now hopefully all of us could | 6,235.119 | 3.6 |
guess that 50 is indeed going to be an | 6,237.04 | 4.28 |
integer that is an INT but we can see it | 6,238.719 | 4.081 |
in this way and this too is what's | 6,241.32 | 2.64 |
powerful about knowing a bit of | 6,242.8 | 2.16 |
programming if you want to know the | 6,243.96 | 3.04 |
answer to a question just try it out | 6,244.96 | 3.8 |
like I am here so let me go ahead and | 6,247 | 4.48 |
run python of type. piy enter and there | 6,248.76 | 5.72 |
it is when you print out the type of the | 6,251.48 | 5.96 |
number 50 you'll see on the screen in | 6,254.48 | 5.44 |
this cryptic syntax class quotee unquote | 6,257.44 | 4.159 |
in this is not something that you | 6,259.92 | 3.719 |
probably want to show to the user but if | 6,261.599 | 3.721 |
you yourself just want to poke around | 6,263.639 | 3.681 |
and see what's going on or maybe use | 6,265.32 | 4.12 |
that information somehow it's certainly | 6,267.32 | 4.279 |
at your disposal to use with this type | 6,269.44 | 4 |
function for that let's change it around | 6,271.599 | 4.201 |
a little bit instead of passing as the | 6,273.44 | 5.32 |
argument to type 50 as an INT let's type | 6,275.8 | 4.919 |
something also familiar like hello comma | 6,278.76 | 4.56 |
World in double or single quotes let me | 6,280.719 | 4.281 |
go back to my terminal window clear the | 6,283.32 | 3.919 |
screen and run python of type. again and | 6,285 | 5.56 |
now voila there it is all this time a | 6,287.239 | 6 |
sure is also a class we can do this a | 6,290.56 | 4.28 |
few more times for instance let's go | 6,293.239 | 4.321 |
ahead and change hello world to just an | 6,294.84 | 5.48 |
empty list open square bracket close | 6,297.56 | 4.36 |
square bracket and this is starting to | 6,300.32 | 3.64 |
look a little cryptic but again notice | 6,301.92 | 3.96 |
what I'm doing in square brackets is an | 6,303.96 | 4.4 |
empty list we've done that before that | 6,305.88 | 4.839 |
is the sole argument to this new type | 6,308.36 | 5.04 |
function and that's just being passed to | 6,310.719 | 4.801 |
the print function so that the return | 6,313.4 | 5 |
value of type is the argument to print | 6,315.52 | 5.119 |
so if I now run this code python of | 6,318.4 | 6.12 |
type. there it is a list is a class two | 6,320.639 | 5.761 |
you might recall that I said that you | 6,324.52 | 3.44 |
can also create an empty list by | 6,326.4 | 3.759 |
literally doing list open parenthesis | 6,327.96 | 4.56 |
close parenthesis this is a bit of an | 6,330.159 | 4.801 |
inconsistency as we can now identify | 6,332.52 | 5.84 |
that int and stir and Now list they're | 6,334.96 | 5.36 |
technically all lowercase and I went to | 6,338.36 | 4.52 |
Great Lengths of creating my student | 6,340.32 | 5.44 |
class to have that capital S that's a | 6,342.88 | 6.12 |
convention because int and stir and list | 6,345.76 | 6.56 |
and others come with py Pon they decided | 6,349 | 5.4 |
to make their buil-in data types even | 6,352.32 | 4.24 |
though their classes all lowercase but | 6,354.4 | 4.04 |
the convention the recommendation in the | 6,356.56 | 3.24 |
python Community when creating your | 6,358.44 | 3.759 |
classes is indeed to capitalize the | 6,359.8 | 4.28 |
first letter as I did in something like | 6,362.199 | 5 |
student capital S but list open | 6,364.08 | 4.8 |
parenthesis closed parenthesis is | 6,367.199 | 3.681 |
identical to really just two empty | 6,368.88 | 4.16 |
square brackets if I clear my screen and | 6,370.88 | 5 |
run type. again you see the exact same | 6,373.04 | 5.079 |
thing the class is called list let's do | 6,375.88 | 4.96 |
one more let me change list to not | 6,378.119 | 4.921 |
square brackets but curly braces we've | 6,380.84 | 4.2 |
done this before anytime I've done two | 6,383.04 | 4.079 |
curly braces with nothing in between | 6,385.04 | 4.32 |
this of course is an empty dictionary or | 6,387.119 | 4.921 |
a dict object in Python well we can see | 6,389.36 | 4.4 |
that now let me clear my screen run | 6,392.04 | 3.96 |
python of type. piy enter and there it | 6,393.76 | 5.04 |
is class dick it's been there this whole | 6,396 | 4.92 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.