text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
tuple as well there's no constraint on | 1,063.48 | 4.319 |
the types of values you can put in there | 1,065.799 | 3.801 |
we've not had occasion to do that in | 1,067.799 | 4.641 |
this case I'm just returning a simple uh | 1,069.6 | 4.88 |
simple tupple with two elements but yes | 1,072.44 | 4.2 |
you could absolutely do that too other | 1,074.48 | 4.8 |
questions on tupples versus lists | 1,076.64 | 4.88 |
okay for example um when I see the | 1,079.28 | 4.8 |
square bracket um is it mainly used for | 1,081.52 | 5.639 |
the list oh a really good question uh | 1,084.08 | 6.76 |
sort of so when you create a value like | 1,087.159 | 5.441 |
a list you use square brackets and that | 1,090.84 | 3.199 |
would indeed be a visual indicator that | 1,092.6 | 4.079 |
this is definitely a list uh if you | 1,094.039 | 4.441 |
instead see parentheses that's a visual | 1,096.679 | 3.641 |
indicator when creating a value that | 1,098.48 | 4.8 |
it's definitely a tuple however somewhat | 1,100.32 | 6.44 |
confusingly both lists and topples use | 1,103.28 | 6 |
square brackets when you access the | 1,106.76 | 4.68 |
contents of them when you index into | 1,109.28 | 4.759 |
them at location zero or location one | 1,111.44 | 5 |
you always use square brackets so that's | 1,114.039 | 4.841 |
the distinction there good question | 1,116.44 | 4.4 |
allow me to propose now if I may that we | 1,118.88 | 4.12 |
solve this problem yet another way and | 1,120.84 | 3.76 |
let's see if we're either making things | 1,123 | 4.039 |
better or for worse than us recall that | 1,124.6 | 4.6 |
dictionaries or dict objects also exist | 1,127.039 | 3.961 |
in python and a dictionary is this | 1,129.2 | 4.28 |
collection of keys and values and the | 1,131 | 4.559 |
upside in particular of a dictionary is | 1,133.48 | 3.48 |
that they have better semantics right | 1,135.559 | 3.161 |
you don't just have to assume that that | 1,136.96 | 3.48 |
a name is always going to be at location | 1,138.72 | 3.56 |
zero house is always going to be at | 1,140.44 | 3.359 |
location one I mean that's the kind of | 1,142.28 | 3.44 |
thing especially if you had three four | 1,143.799 | 4.441 |
or more values eventually you or someone | 1,145.72 | 4.4 |
is going to get confused and forget what | 1,148.24 | 3.72 |
the order is and you're going to write | 1,150.12 | 4.4 |
buggy code so a dictionary is a little | 1,151.96 | 3.8 |
more powerful and that you can | 1,154.52 | 3.639 |
semantically associate Keys like little | 1,155.76 | 5.159 |
descriptions with the values those keys | 1,158.159 | 4.841 |
and those values respectively so let me | 1,160.919 | 3.401 |
go ahead and do this and we can do this | 1,163 | 3.2 |
in a few different ways but let me | 1,164.32 | 3.719 |
propose that we focus on get student | 1,166.2 | 2.8 |
here | 1,168.039 | 3.161 |
and let's go ahead and do this let me go | 1,169 | 4.919 |
ahead and uh in delete the | 1,171.2 | 4.88 |
implementation of get student Asis let | 1,173.919 | 4.12 |
me create a student variable and | 1,176.08 | 4.04 |
initialize it to an empty dictionary and | 1,178.039 | 4.561 |
I can do that with just two curly braces | 1,180.12 | 4.32 |
here and then let me go ahead and set | 1,182.6 | 4.439 |
two keys inside of that dictionary | 1,184.44 | 3.88 |
inside of the student there will be | 1,187.039 | 3.841 |
quote unquote a name key and the value | 1,188.32 | 4.16 |
of that is going to be whatever the | 1,190.88 | 3.44 |
return value of input is when I prompt | 1,192.48 | 4.4 |
the user for their name and then the | 1,194.32 | 4.4 |
house key inside of that that same | 1,196.88 | 3.32 |
student dictionary is going to be the | 1,198.72 | 3.88 |
return value of whatever the user types | 1,200.2 | 4.64 |
in for their house and lastly I'm going | 1,202.6 | 5.52 |
to go ahead and return student so now I | 1,204.84 | 6.24 |
am literally returning one thing still | 1,208.12 | 5.439 |
but this time it's a dict rather than a | 1,211.08 | 4.479 |
tupple rather than a list but there's | 1,213.559 | 4.12 |
still two things in it technically four | 1,215.559 | 3.681 |
things if you count the keys and the | 1,217.679 | 4.721 |
values but there's two key value pairs | 1,219.24 | 4.559 |
now my code up here is going to have to | 1,222.4 | 3.04 |
change a little bit and let's simplify | 1,223.799 | 4.041 |
this and remove for instance now the the | 1,225.44 | 4.96 |
pad if statement just to focus on what's | 1,227.84 | 4.719 |
changing at hand and let me go ahead now | 1,230.4 | 3.96 |
and leave line two alone I'm still going | 1,232.559 | 4.24 |
to have a student variable that gets | 1,234.36 | 4.92 |
assigned the return value of get student | 1,236.799 | 4.561 |
but what I want to do here now is | 1,239.28 | 6.04 |
actually access the keys inside of that | 1,241.36 | 6.319 |
dictionary not by numeric index which | 1,245.32 | 4.88 |
was for tuples and lists zero and one | 1,247.679 | 5.801 |
but by way of the keys now normally I | 1,250.2 | 5.12 |
might be in the habit as I personally am | 1,253.48 | 3.76 |
of using double quotes quote unquote | 1,255.32 | 5.04 |
name inside of there and quote unquote | 1,257.24 | 5.84 |
house inside of there but before I even | 1,260.36 | 5.52 |
run this code and show you a mistake see | 1,263.08 | 4.8 |
an error on the screen does anyone want | 1,265.88 | 4.799 |
to call out what I have done wrong here | 1,267.88 | 5.32 |
this is just an F string I just want to | 1,270.679 | 5.081 |
print out the value of the name key the | 1,273.2 | 3.839 |
value of the house key in this | 1,275.76 | 3.799 |
dictionary | 1,277.039 | 2.52 |
but you're your audio was a little | 1,280.6 | 3.72 |
garbled for us but I think I heard | 1,282.799 | 3.401 |
double quotes and single quotes so I'm | 1,284.32 | 3.4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.