Python for Informatics – Chapter 9 – Dictionaries



Hello again, and welcome to
Chapter 9, Python dictionaries. As always this lecture is
copyright Creative Commons Attribution, that means the
audio, the video, the slides and even my scribbles you
can use in any way you like. As long as you attribute them. OK so, this is
the second chapter we're talking about collections. And the collections are kind
of like a piece of luggage in that you can put
multiple things in them. Variables that
we've talked about, sort of starting in chapter
two and chapter three, were simple variables. Scaler, they're just kind of
one thing and soon as you like, put another thing in there it
overwrites the first thing. So, if you look at the code
x equals 2 and x equals 4, the question is you know,
where did the two go? All right the two was
there, x was there, there was a two in there,
and then we cross it out and put four in there. This is sort of the basic
operation, the assignment statement it's a replacement. But a dictionary allows us to
put more than one thing, not using this syntax,
but it allows us to have a variable that's really
an aggregate of many values and the difference between
a list and a dictionary, is how the values are structured
within that single variable. The list is a linear collection
indexed by integers, zero, one, two, three. If there's five of them,
it's zero through four. Very much like a
Pringles can here, where they're just
stacked nicely on top of each other,
everything's kind of organized. We talked about in
the last lecture, this lecture we're talking
about dictionaries. Dictionaries' very powerful,
and it's power comes from a different way of
organizing itself internally. It's a bag of values,
like a, just a, sort of, just stuffs in it, it's not
in any order, big stuff, little stuff,
things have labels. You can also think of it like
a purse, with just things and it's like, it's
not like stacked, it's just stuff moves
around as you're going. And that's a very good
model for dictionaries. And so dictionaries have to have
a label, because the stuff is not an order. There's no such thing
as the third thing. There is the thing
with a label perfume. There's the thing
with the label candy, there's the thing
with the label money. And so there's the value, the
thing, the money, and then there's always also the label. We also call these key value. The key is the label, and
the value is whatever. And so these pink things are
all labels for various things that you could put in the purse,
so you could say to your purse, hey purse give me my tissues,
hey purse give me my money and it's in there somewhere
and the purse sort of gives you back the tissues or the money. And it's– Python's most
powerful data collection is the dictionary. And when you get used
to wielding them, you'll say like whoa I can
do so much with these things. And at the beginning you're
just sort of learning, sort of how to use them
without hurting yourself. But they're very powerful. It's like a database. It allows you to store very
arbitrary data organized in however you feel
like organizing it, in a way that advances the
cause the program that you're writing. We're still kind of
at the very beginning, but as you learn more,
these will become a very powerful tool for you. Dictionaries have different
names in different languages. Perl or Php would call
them Associative Arrays, Java would call them a
Property Map or a HashMap, and C# might call them a
Property Bag or an Attribute Bag. And so they're just
the same concept, it's keys and values
is the concept, that's across all
these languages, just a very powerful one. And if you look at the Wikipedia
entry that I have here, you can see that it's
just, it's a concept that we give different names
in different languages. Same concept, different names. So like I said, the
difference between a list and a dictionary, they both
can store multiple values. The question is how we label
them, how we store them, and how we retrieve them. So here's an example
use of a dictionary. I'm going to make a
thing called purse, and I'm going to
store in purse, this is an assignment statement,
purse sub money so this isn't like sub zero, this is money. So I'm actually using
a string as the place. And so I'm going to say
stick 12 in my purse, and stick us posted note,
that's my money, candy is three, tissues is 75. And if I look at that, it's not
just the numbers 12, 3 and 75 as it would be in a list, it
is the connection between money and 12, tissues is
75, candy is three. And in the key value, that's
the key and that's the value. So candy is the key,
and three is the value. Now I can look things up by
their name, print purse sub candy. Well goes finds it, asking
hey purse give me that candy, and it goes and finds the
value which is three and so outcomes a three. We can also put it on the right
hand side of an assignment statement. So purse of candy says give
me the old version of candy, and then add two to
it, which gives me 5. And then store it back in that
purse, under the label candy. So we see candy
changing to five. And so, this is a place, and
you could do this with a list except these would be numbers. You could say purse sub
2 is equal to purse sub 2 plus 2 or whatever. But in dictionaries,
there are labels. Now they're not strings. Strings is a very common
label in dictionaries, but it's not always strings. You can use other things. In this chapter we'll pretty
much focus on strings. You could even use
numbers and then you would get a little
confused, but you can. So here's sort of a
picture of how this works. So if we take a look at this
line purse sub money equals 12, it's like we are putting
a key value connection, money is the label for 12, and
then we sort of move that n. And it's up to the purse
to decide m things live. If we look at the
next line, we're going to put the value n three
with n with the label candy, and we're going to put the value
75 in with a label of tissues. And when we say hey
purse print yourself out, it just goes and pulls
these things back out and hands them to her. And what it's really,
it's giving us both the label and the value. And it's necessary to do
that, because there's just 12, 75 and three,
what exactly is that? And so this syntax
with the curly braces is what happens when you
print a dictionary out. The same thing happens when
we're sort of printing purse sub candy. Right? Purse sub candy, it's
like, you're first, go and find the candy
thing, look at that one, look at that one, oh
yep yep this is candy. But what we're looking
for is the value, and so that's why three
is coming up here. So go look up under
candy and tell me what's stored under candy. These can be actually
more complex things and I'm just keeping it
simple for this lecture. And then when we say purse
sub candy equals purse sub candy plus 2, well
it pulls the three out looking at the label
candy, then adds 3 plus 2 and makes five, and then
it assigns it back in. And then that says oh
go go place this number five in the purse with
the label of candy, which then replaces
the three with a five. OK and if we print
it out, we see that the new variable, or the
new candy entry is now five. OK? So if we just sort of put
these things side by side, we create them sort
of both the same way and we make an empty
list an empty dictionary. We call the append method
because we're sort of just putting these things in order. You've got to put the
first one in first. So it's not telling you
where, you kind of know that this would be the
first one because you're starting with an empty one, and
this will be the second one. We put in the values 21 and
183 and then we print it out and it's like OK, you gave
me the value as 21 and 183. I will maintain
the order for you, there's no keys other
than their position. Position is the key, as it were. If I want to change
the first one to 23, well, I say lists of
zero which is this, and then change that to 23. So this is sort of used as
a look up to find something. Can be used on either the right
hand side or the left hand side of the science statement. Comparing that to dictionaries,
I want to put a 21 in there and I'm going to put
it with the label age, and put 182, put that in
with the label course. So, so we don't have
to like make an entry. The fact that the entry doesn't
exist, it creates the age entry and sticks 21 into it. Creates the course entry,
sticks 182 into it, we print it out and says, oh
course is 182 and age is 21. This emphasizes that order is
not preserved in dictionaries. I'm won't go in that
I like great detail as to why that it is. It turns out that
that's a compromise that makes them fast. Using a technique
called hashing. It's how it's actually
works internally go to Wikipedia hashing
and take a look, but the thing that matters to
us as programmers primarily is that lists maintain
order and dictionaries do not maintain order. Dictionaries give
us power that we don't have unless, I mean
they're very complimentary. There's not this one that's
better than the other, they're very complimentary. Different kinds of data is
either better represented as a list or as a
dictionary depending on the problem trying to solve. And in a moment,
we'll be writing programs that are using both. So if we come down here
and I say OK stick 23 into assignment statement,
into ddd sub age, well that will change this
21 to 23, so we print it out. So you can, this part where you
look something up and change the value, you
can do either way, it's just how you do it here
is a little bit different. OK. So let's look through
this code again. And so, I like to use
the word key and value. Key is the way we look
the thing up in a list, keys are numbers starting
at 0 and with no gaps. In dictionaries, keys are
whatever we want them to be, in this case I'm using strings. And then the value is the
number we're storing in it. So we create this kind of a list
with those kinds of statements, this statement creates
this kind of a thing. Now if we think of this
assignment statement as moving data into a new, into
a place, a new item of data into a place, it's looking
at this thing right here. It's like that's where
I want to move it and so it hunts and
says look the key up and that's the one that
I'm going to change, and then once it knows which
it's going to change then it's going to take
the 23, then it's going to put the 23
into that location. And so that's how this
changes from that to that. Similarly when we
get down to here, we're going to
stick 23 somewhere and this expression,
this look up expression, the index expression,
dd sub age, is where we're going to put it. So we're looking here,
where is that thing. Well that thing is this
entry in the dictionary, and so now we're
going to store the 23, we know where the
23 is going to go, it's going to overwrite
the 21 and so the 21 is going to change to 23. OK. So so they're kind
of similar, there are things that
work similar in them and then there are things
that work differently in them. We can make literals,
constants, with the curly braces and they look just
like the print. That's one nice
thing about Python, when you print
something out, it's showing you how you
can make a literal and basically you just
open with a curly brace and say chuck colon
one, Fred 42, Jan 100 and we're making connections. Key value pair, key value pair. We print it out and no order,
they don't maintain order. Now that might come
out in the same order but that's just lucky. Right, all the ones
I've shown you so far, don't come out in
the same order, which is good demonstrated. If it one time came out
in the same order, that wouldn't be broken,
it's not like it doesn't want to come out in the
same order, it's just, it's not internally stored. And you add an element
and it may reorder them. You can do an empty dictionary
with just a curly brace, curly brace. So, I'm going to give
you another example. And I'm going to show
you a series of names, and I want you to figure out
what the most common name is, and how many times
each name appears. Now these are real
people that actually work on the Sakai project,
Stephen, Zhen, and Chen, and me. So these are people that
are actually in the data that we use in this course. OK and so I think I'll
show you about 15 names, and you're to come
up with a way, I'm going to show them
to you one at a time. You need to come up with a
way to keep track of these. OK? So I'll just with no further
ado, I will show you the names. OK so that's all the names. Did you get it? You might have to go
back and do it again. How did you solve the problem,
what kind of a data structure did you build to solve the
problem or did you just say, wow that's painful, I think
I will learn Python instead in solving that problem. So pause the video if
you want and write down, or go back write
down what you think the number of the most common
name is and how many times. OK now I'll show you. So here is the whole list. It's all of them. And now that we see all of them,
we use our amazing human mind and we scan around and look at
purpleness and all that stuff, and then we go like, oh this is
a so much easier problem when I'm looking at the whole thing. And I think that the most
common person is Zhen, and I think we see Zhen, I
think we see Zhen five times, and I think Csev
is one, two three, and Cwen is one, two,
and Stephen Marquard is one, two, three. So the question is what is
an effective data structure, if you're going to see
a million of these? What kind of data structure
would you have to produce, because you can't
keep it in your head? Even this number of people,
you can't, even this amount of data no way you can
keep it in your head. You have to come up with some
kind of a variable as it were, just like largest so
far was a variable. Some kind of variable
that gets you to the point where you
understand what's going on. And so this is the
most common technique to solve this problem,
where you keep a running total of each of the names. And if you see a new name,
you add them to the list. So Csev and then you give him
a one, and then you see Zhen and you give her a one
and then you see Chen and you give her a one,
and then you see Csev again and you give him a two, and
you see and a two, and a two, and a one right? And so then when
you're all done, you have the mapping,
right of these things and you go OK let
me look through here and find the largest one,
that's the largest one, so that must be the
person who is the most. So you need a scratch
area, a data structure or a piece of paper as it
were, and so that's what, exactly what dictionaries
are really good at. You could think of this
as like a histogram. You know it's a
bunch of counters, but counters that are
indexed by a string. So we use a lot of this. And so this is a pattern of
many counters with a dictionary. Simultaneous counters. Were counting a
bunch of– they were looking at a series
of things and we're going to simultaneously
keep track of a large number of counters,
rather than just one counter. How many names you
see total whatever, 12, but how many of
each name did you see is a bunch of counters. So it's a bunch of
simultaneous counters. So a dictionary
is great for this, dictionary is great for this. When we see somebody
for the first time, we can add an entry
to the dictionary, which is kind of like going
Csev one and then Chen Wen one. Now these don't
exist yet, all right so we got Csev one and Chen Wen
one so that creates an entry and sticks a one in it and new
mapping between the key Csev and the value one, the key
Chen Wen and value of one, and we say hey what's in
there, oh we got Csev as one and Chen Wen is one and then we
see Chen wen second time so we add another number right
there, so this old number is one we add one
to it, we get two and then we stick that back in
and then we do the calculation, we do a dump and say oh
there's two in Chen Wen and one in Csev. OK So this is a great
data structure for these simultaneous
counters, like what's the most common word,
who had the most commits. Now everything we do,
we have to figure out like when you're going to
get in trouble with Python, when Python's going to give
you the old thumbs down and say yup you went too far. So one thing Python
does not like , is if you reference a
key before it exists. We'll look at in a second
how to work around this, but if you simply
create a dictionary and say oh print out
what's under Csev, it gives you a trace
back, it's like I'm going to inform you
that that's not there. And it's a key error Csev. Now the thing that allows us to
solve this, is the in operator. We've used the in operator
to see if a substring was in a string, or the
number was in a list, so so there's in operator
says, in operator says, hey ask a question. Is the string csev a current
key in the dictionary ccc. Is the string csev a current
key in the dictionary ccc, and it says false. So now we have
something that doesn't give a trace back that
can tell us whether or not the key is there. So if you remember
the algorithm, the first time you see
it you set them to one, and every other time
you add one to them. So this how we do
that in Python. So here's how we
implement that program that I just gave you in Python. So here's our
names, it's shorter so my slide works better. Here's variable, our
iteration variable it's going to go through all
five of these one at a time and within the body of the
loop, we have an if statement. If the name is not currently in
the counts dictionary counts is the name of my dictionary,
if the name is not currently in counts dictionary, I say
counts of name equals one. Else, that must
mean it's already there which means it's
OK to retrieve it, counts sub name plus 1,
we're going to add a 1 to it and stick it back in. OK And so when this finishes, it's
going to add entries and then add one to entries today
that already exist, and not trace back it all,
and when we print it out we're going to see
accounts and literally this could have gone a million
times and it would just be fun and it would just
keep expanding. OK? So this pattern
of checking to see if the key is in a dictionary,
setting it to some number, or adding one to it, is a
really, really common pattern. It's so common as
a matter of fact, that there is a special thing
built into dictionaries, that does this for us. OK and there is this
method called get. And so counts is the
name of the dictionary, get is a built in
capability of dictionaries and it takes two parameters. The first parameter
is a key name, like a string like
csev, cwen or marquard. And then the second
parameter is a value to give back if
this doesn't exist. It's a default value if
the key does not exist and there's no trace back. So this way you can encapsulate
in effect if then else. If the name parameters
is in the counts, print the thing out,
otherwise print zero. So this expression will
either get the number, if it exists, or it
will give me back a zero if it doesn't exist. So this is really
valuable, right? This is really valuable. That's a pretty bad Smiley face. So this is really
valuable because it– once we understand the idiom, It
really takes four lines of code and turns it into
one line of code. Because we're going to be doing
this if then else all the time. Now we can reconstruct that
loop a lot easier and a lot more cleanly using this idiom. Right? It's something that
looks kind of complex, but you'll get used
to it really fast. So we have everything
here is the same, we create an empty dictionary we
have five names to go through, we're going to write
a loop and it's going to go through
each of those, and then we're going
to say, counts of name equals counts dot get
the value stored at name, and if you don't find
it give me back a zero. And then whatever comes
back either the old value or the zero, add one to
that and then take that sum and stick it in counts name. So this is either
going to create, or it's going to update. If there is no entry, it's
going to create it and set it to one, if there is an
entry it's going to add one to the current entry. OK so this is, this line
is kind of an idiom. Read about it in the
book, figure it out, get used to the notion
of what this is doing. Understand what that is doing. OK? Because I'm going to start using
it as if you understand it. So the next problem
is, a problem of finding the most common word. So finding the most
common the top five, is often a trigger that
says use dictionaries, because if you're going
to have to count things up you don't know what the
most common thing is at the beginning, first you
have to count everything up, and dictionaries are
a great way to count. So here's a little
problem and I would like you to read
this text and find me the most common
word in the text and tell me what the
most common word is and how many times it occurs. Ready? I'm going to give you a
thousandth of a second, just like I would
give a computer. I would expect that
they'll do this in a thousandth of a second. There you go. OK I gave you five seconds,
times up, did you get it? Or did you say to
yourself, you know what I hate that,
it's no good, I think I'll write a
Python program instead. And you'll probably
show me a Python program if I wait long enough. So here's a slightly
easier problem, from the first lecture. Ready? It's the same problem,
find the most common word and how many times
the word occurs. Did you get it? I believe the answer is, and
I could look really dumb here, the answer is, the and I
think it's seven times. So that's the right answer. OK. Again things humans
are not so good at. So here's a piece of
code that's starting to combine some of
the things we've been doing in the past
few chapters all together. We are going to read a line
of text, split it into words, count the occurrence, how
many times each word occurs and then print out a map. So, so here's what
we're going to do. We're going to say OK start a
dictionary an empty dictionary. Read a line of input. Then split it, remember
the split takes a string and produces a list. So words is a list,
line is a string, and then we'll print that out. Then we're going to
write a for loop that's going to go through
each of the words, and then create, use this
idiom, counts of word equals counts dot get
word comma 0 plus 1. So this is going to
do exactly what we talked about in the
previous couple slides back. Either create the entries
or add to those entries. OK and then we're going
to print them out. So here's what that program
does, when it prints out. Now this is actually
one long line I'm just cutting it so
you can see it here's this line we enter and the
words the they're seven of them, then it takes this line
and splits it into a list and there is the beginning
and end of the list. The list maintains the
order, so the list simply breaks all these words
into separate words in a list of strings, from
one string too many strings. This is many strings,
and so the and spaces are gone and so
here's this list, and then what we're
going to do is we are going to run
through the list and we are going to
keep running totals of each of the words in
the list and then we're done with a list, we're
going to print out the contents of that dictionary
and we can inspect it, go like let's look
for the biggest one, it's kind of like looking for
the largest, like oh seven, that's the largest and
the largest word is the. OK so that's how
the program runs. It reads a line, splits
it into a list of words, and then accumulates a
running total for each word, and then we hand inspect to see
what the most common word is. OK Oh no no, I don't
want that song again. There we go. And so here we have the, in
this kind of a smaller fashion, we make a dictionary. This entering a line of text
is here, it's all one line, we do the split and then
we print the words out and so that split creates a list
of strings from a single string based on where the blanks are
at chop, chop, chop, chop, and then here it
counting, we're going to loop through each of
the words, one at a time and use this idiom
counts of word equals counts that get word
comma 0 plus 1, which is going to create and/or update. And then we print the counts
out and that comes up there. OK so again, this is the
new thing we've done. Everything else here
we've kind of seen before. Now we can also loop through
dictionaries with for loops. The for loop we've been put
all kinds of things over here, we put strings over here, we
put listed numbers over here, we put files over
here, and basically what it really says is this
is a collection of things, run this little
indented code once for each item in the
collection and key then becomes our
iteration variable, and key is very mnemonic here. It doesn't know
that they're keys. And so keys, the key here,
is that there's a bit, the important concept
here is that dictionaries are key value pairs. And so this is only
one variable and so it actually decides
that they've decided it goes through the keys,
which is actually quite useful. So key is going to take
on the successive, values of the labels, not the
successive values of the value stored at the labels. But it's really easy for
us to retrieve the contents at that label, counts sub key. So we're going to use the key
chuck, fred, jan to look up the 140 to 100 and so it
prints out the key and then the value added, the
key and the value added, and the key and the value. And so we're able to sort
of go through the dictionary and look at all the
key value pairs, which is the common thing that
you really want to do. OK? Now there's some methods
inside of dictionaries that allow us to
convert dictionaries into lists of things and so if
you simply take a dictionary, so here's a little dictionary
with three items in it, and we can say list sub and then
give a dictionary name, right there, and then that
converts it into a list but it's just a
list of the keys. We can also say jjj dot keys,
kind of do the same thing, say give me a list
consisting of the keys. And then jjj dot values gives
you a list of the values. 142 and a 100. Of course they're not
in the same order. Now interestingly,
as long as you don't modify the dictionary,
the order of these two things corresponds, as long
as in between here you're not changing it. So the first jan maps to
100, chuck maps to one, and fred maps to 42. So the order, you
can't predict the order they're going to come out but
these two things will come out in the same order whatever
that order happens to be. OK and so there's
one more thing. So we got the keys,
we've got the values, and we have a
thing called items. Items also returns a list. It's a list, but it's a list
of what Python calls, tuples. That's what the next
chapter is about. We'll talk more about
tuples in the next chapter. A tuple is a key value pair. So this list has
three things in it. One, two, three. The first one is
jan maps to a 100, the second one is
chuck maps to one, the third one is
fred maps to 42. So just kind of bear
with me for a second, we'll hit this a little
harder in the next chapter. But the place that the city
and more this works really beautifully is on a for loop. Now for those of you who have
programmed in other languages, this will be kind of weird. Because other languages
have iterations. But they don't have two
iteration variables. Python has two
iteration variables. It can be used for
many things but one of the things that
it's used for, that's really quite nice is
we can have two iterations variables, this jj items
returns pairs of things, and then aaa and
bb are iteration variables the sort of
move in, is synchronized, are synchronized as
they move through. So aaa takes on the value of
the key, bbb takes on the value. And then the loop runs ones then
aaa is advance to the next key, and bbb is advanced to the
next value simultaneously, synchronized. Then they print that
out then it advances to the next one, and the next
one, and they print that out. So they are moving in
a synchronized way. Now again the order Jan,
Chuck, Fred is not the same, but the correspondence
between Jan 100, Chuck one and Fred, that's going to work. And so basically
as these things go, they work their way
through whatever order they're stored in
the dictionary. So this is quite nice. Two iteration variables
going through key value. Now if I was making
these names mnemonic, and they made more
sense, I would call this the key variable and
that be the value variable. But for now, I'm just
using kind of silly names to show you that key and
value are not special, they're not Python
reserved words in any way, they're just a good way to name
these things key value pairs. OK. OK, now we're going to
circle all the way back to the beginning, all the way
back to the first lecture. And I gave you this program,
I said don't worry about it, will learn about it later. Well now later. At this point, you should
be able to understand every line of this program. This is the program
that's going to count the most common word in a file. So let's walk
through what it does and hopefully by now this
will make a lot of sense. OK So we're going to
start out, we're going to ask for file name. You're going to open
that file for read, then because we know it's
not a very large file, we're going to read it all in one
go, so handle dot read says, read the whole file new lines
and all, blanks, new lines, whatever, and put it in
a variable called text. Just mnemonic,
remember I'm starting, this one I'm using
mnemonic variable names, then go through that
whole string, which was the whole file. Go through and split it all. New lines don't hurt it, new
lines are treated like blanks, and it understands all that,
it throws the new lines away and the blanks
away and splits it into a beautiful list of
just words with no blanks. In the list of the
words in that file ends up in the variable words. Words is a list, text is
a string, words is a list. Then what I do is the pattern
of accumulating counters in a dictionary. I make an empty dictionary,
I have the word variable goes to all the words, and
then I just say counts of word equals counts word dot get. Word comma 0 plus 1. That, like we just
got done saying, it both creates and or
increments the value in the dictionary as needed. So now at this point
in the program, we have a full dictionary
with the word colon count. OK, and there's many them. All the words all the counts. Not in any particular order. So now what we're
going to do, is we're going to write
a largest loop. Find the largest, which is
another thing we've done. So not only do I
not need know what the largest count
I've seen so far, I need to know
what word that is. So I am going to set
the largest count we've seen so far to none,
set the largest word we've seen so far
to none, and then I'm going to use this two
iteration variable pattern to say go through
the key value pairs, word, and count. In counts item, so it's going
to just go through all of them and then I'm going to ask,
if the largest number I've seen so far is none, or
the current count that I'm looking at, is greater
than the largest I've seen so far, keep them. Take the current word stick
it and biggest word so far, take the current account stick
it in the biggest count so far. So this is going to run through
all of the word count pairs, word count key value pairs,
and then when it comes out, it's going to print out the
word that's the most common and how many times. So if we feed in that context
it will run all this stuff and print out, Oh the,
is the most common word and appeared seven times. Or if I print the stuff
that was two slides back, words dot txt from
the actual textbook, then it says the word
two is the most common and happened 16 times. So I could easily throw 10
million, 10 million words through this thing and it
would just be totally happy. Right? And so this is not that
complex of a problem, but it's using a whole bunch of
idioms that we've been using. The splitting of
words, the accumulation of multiple counter and a
dictionary, and so it's sort of is, the beginning of doing
some kind of data analysis that's hard for humans
to do, and error prone for humans to do. And so this is we're
reviewing collections, we've introduced dictionaries. We've done the most common
word pattern, talked about that, a lack
of order, I get that a bunch of times,
and we've looked ahead at tuples, which is the next,
the third kind of collection that we're going to
talk about and they're actually in some ways a little
simpler than dictionaries, and simpler than lists. So see you in the next lecture. Chapter 10, tuples.

25 Comments

  1. Ajay Prajapati said:

    very nice lecture..

    June 26, 2019
    Reply
  2. John Steidley said:

    Really nice teaching style (and this from an OSU Buckeye). Thanks for sharing

    June 26, 2019
    Reply
  3. Sara Randalll said:

    Wow! I love your videos. I am a non-mathematically minded person, taking beginner programming and you explained things for me in a way I could understand. Love the pictures and writing on the screen as you teach. Awesome!

    June 26, 2019
    Reply
  4. Mahi MSD said:

    I have only one word for you WOW

    June 26, 2019
    Reply
  5. vtj808 said:

    Loving you tutorials! Thank you so much! 😀

    June 26, 2019
    Reply
  6. Chuck Severance said:

    This video is Python 2.x – there are Python 3.0 versions of all these lectures www.py4e.com

    June 26, 2019
    Reply
  7. CODER0523 said:

    Do you use python 3 or python 2?

    June 26, 2019
    Reply
  8. Hunter said:

    I don't normally comment, but this video finally helped me wrap my head around this. My professor didn't do a very great job.. Thank you!!

    June 26, 2019
    Reply
  9. farouk aregbe said:

    this is my first ever comment on a youtube page… I have come to appreciate great teachers and
    Chuck is a great one

    June 26, 2019
    Reply
  10. Sweettoontown said:

    Thank you, Sir. You are awesome !!! 😊

    June 26, 2019
    Reply
  11. Buddha_ reincarnated said:

    Wow the way this guy is teaching this stuff lol. Using pictures and real stuff world examples for the simplest of things . Everything this guy says I could have effectively learned in 5-10 mins tops from scratch. Do white guys learn so slowly . Btw I'm indian

    June 26, 2019
    Reply
  12. Kuz L said:

    Awesome

    June 26, 2019
    Reply
  13. AMIT SINGH said:

    hello Dr. Chuck, thanks for these easy but informational lectures

    i have a query on dictionary , if we convert a two column file into dictionary , how we append multiple values for a key

    June 26, 2019
    Reply
  14. Jackie M said:

    Really well done. You have a cool setup!

    June 26, 2019
    Reply
  15. solomon ezhra said:

    Amazing lecture .Thanks very much for sharing

    June 26, 2019
    Reply
  16. ali veli said:

    i am really learning programming… sounds crazy but yeah…
    unfragingbelievable…

    June 26, 2019
    Reply
  17. Peter Farrell said:

    Great introduction. Well-organized and clearly presented.

    June 26, 2019
    Reply
  18. Jack Yau said:

    can dictionaries contain more than 2 values for each key?

    June 26, 2019
    Reply
  19. Alex Carlson said:

    Excellent video! Subscribed.

    June 26, 2019
    Reply
  20. Alex Carlson said:

    Vernors!

    June 26, 2019
    Reply
  21. Kevin White said:

    Chuck's Avatar picture is the best. This is a man of true panache. Chuck for President.

    June 26, 2019
    Reply
  22. Aleksi Dragoev said:

    I actually did the most common name thing in my head

    June 26, 2019
    Reply
  23. Robert100R said:

    you are an amazing guru… thx… 🙂

    June 26, 2019
    Reply
  24. goldiethemack said:

    Vernor's mmmmmm

    June 26, 2019
    Reply
  25. sanshinron said:

    It's funny how every next chapter has less and less views… People give up so easily…

    June 26, 2019
    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *