COLTON OGDEN: This is CS50 on Twitch.
My name is Colton Ogden
and I'm joined today by--
VERONICA NUTTING: Veronica Nutting.
Thanks so much for having me today.
COLTON OGDEN: Absolutely, yeah.
Why don't you tell everybody-- our
fine audience on Twitch first of all,
your relationship with CS50 and
then maybe some more about yourself.
VERONICA NUTTING: Sounds good.
Hey, everyone.
So I'm CS50's head course
assistance here at Harvard.
A little bit about me--
I'm from West Virginia and Argentina.
I took CS50 last year.
I'm a computer science
major here at the college.
And I'm super duper
excited to be here today.
Python is my favorite language.
COLTON OGDEN: It's a good language.
VERONICA NUTTING: Yes, primarily because
it's named after Monty Python, perhaps
my favorite comedy troupe.
COLTON OGDEN: Fun fact.
That's one cool thing.
VERONICA NUTTING: That's
one cool thing, yeah.
So this is 100 things that's
going to take quite a bit.
This will likely be a multipart series.
So stay tuned.
You're hopefully going to
be seeing a lot of my face.
COLTON OGDEN: And you're actually
doing a big part of the translation
project for CS50 into Spanish.
VERONICA NUTTING: I am, yeah.
So as I mentioned, born in
Buenos Aires, have grown up
in West Virginia and Argentina.
And as part of CS50's
push to accessibility,
push towards reaching as
many people as we can,
we're translating and trying
to get as much Spanish stuff
out there as possible.
So I've been, I think, a
pretty big part of that.
I worked a bunch over
that over the summer.
And then there's a lot
left to do and we're
super excited to keep working on that.
COLTON OGDEN: Yeah.
I think David showed your--
is it Super Mario Brothers?
VERONICA NUTTING: He did.
Yeah, so I've gotten so many Snapchats
and text messages and tons of people--
just such positive feedback.
I think people are really happy that
we want to reach the Hispanic world.
We're getting there.
We're very excited.
And then after Spanish, could
be any number of languages.
COLTON OGDEN: Yeah, I know
we're working on Arabic
and, I think, Russian or Ukrainian,
as well, through a third party.
But yeah, definitely as
many languages as we can.
We got to spread CS50--
spread the love, right?
VERONICA NUTTING: Yeah.
COLTON OGDEN: I don't think
our chat box-- for some--
VERONICA NUTTING: Oh,
wait, that's so cool.
COLTON OGDEN: It got messed up, I think.
VERONICA NUTTING: This
chat is really funny.
I can't wait to communicate
with all of you.
COLTON OGDEN: We got a lot of--
VERONICA NUTTING: It is
named after Monty Python.
Isn't that so cool?
If any of you haven't seen the movies,
I really, really highly recommend them.
COLTON OGDEN: Yeah,
no, they're fantastic.
The Holy Grail-- what's the other one?
VERONICA NUTTING: Meaning of Life--
COLTON OGDEN: Meaning of Life.
VERONICA NUTTING: And Life of Brian.
They're the only movies that
I have saved on my iPad.
COLTON OGDEN: Yeah,
no they're hilarious.
VERONICA NUTTING: I can rewatch them--
COLTON OGDEN: I didn't
appreciate them as much as a kid.
I think they're funnier
the more you gain--
VERONICA NUTTING: Yeah, for sure.
COLTON OGDEN: --insight
into the world, I think.
Let's read some of these messages.
We have a bunch of people
that tuned in advance.
We were a couple of minutes later today,
so we had a few of those messages.
We had to get some stuff set up.
VERONICA NUTTING: "Super
excited for this session."
Ditto.
COLTON OGDEN: Scotty says, "Is there
any language Colton doesn't know?"
Yes, there are plenty of languages,
like real languages that I don't know.
I pretty much only
really know English well.
I've dabbled in a few other languages.
VERONICA NUTTING: What other languages?
COLTON OGDEN: A little
bit of Spanish, but--
VERONICA NUTTING: OK.
COLTON OGDEN: Don't challenge
me to speak it, though.
VERONICA NUTTING: You could
join our translating team.
What about-- what percentage
of computer science languages
do you think you know?
What percent?
COLTON OGDEN: Are we considering every--
VERONICA NUTTING: Yep.
COLTON OGDEN: --small language?
Probably like 0.2%, 0.1%.
There's thousands of programs--
VERONICA NUTTING: No, yeah, I know.
That's realistic and humble.
COLTON OGDEN: Like, main computer--
big programming languages?
Quite a few of them, to a degree.
But I'd say Python's one
I'm very comfortable with.
VERONICA NUTTING: Good.
COLTON OGDEN: JavaScript
is reasonably comfortable.
VERONICA NUTTING: OK.
COLTON OGDEN: Lua I teach
with and C# I teach with.
VERONICA NUTTING: Right.
Yeah.
You should definitely check out--
I'm sure all of you are
quite familiar with Colton,
but he has a lot of
great resources online.
COLTON OGDEN: Much appreciated.
VERONICA NUTTING: If you're
cruising game development.
COLTON OGDEN: Thank you.
VERONICA NUTTING: Let's see what else.
Music is pretty good here.
I agree.
We have a DJ in the house.
I don't know if anyone knows this.
COLTON OGDEN: We're jamming
out a little bit in advance.
Hezekiahma, Hello,
everyone." bhavik_knight,
"Maybe assembly language?"
I have been learning a little
bit of assembly language.
Have you dived--
VERONICA NUTTING: Actually, yeah, no.
I'm taking a systems programming class.
So actually, I've been looking at a
lot of assembly language recently.
COLTON OGDEN: Do they use x86 assembly?
VERONICA NUTTING: Yeah, x8664.
COLTON OGDEN: OK.
VERONICA NUTTING: Yeah.
Is that what you--
COLTON OGDEN: No.
6502, which was the old CPU
from the '70s and '80s for NES,
the Commodore 64, a
little bit of the Z80
because that's what the
Gameboy was programmed in.
VERONICA NUTTING: Interesting.
Oh, wow.
COLTON OGDEN: But yeah,
it's a rough journey.
VERONICA NUTTING: Was that your era?
COLTON OGDEN: No, that was not-- well,
original Gameboy with Pokemon-- anybody
else in the chat, anybody else
programmed playing Pokemon back
in the '90s?
Did you play Pokemon?
VERONICA NUTTING: No.
I was born in '98, so--
COLTON OGDEN: Oh.
OK.
Well, Pokemon was at its
prime in '99, I guess.
So maybe growing up as a small
child you might have had it
or had friends that had it.
VERONICA NUTTING: Yeah,
like, Pokemon, Yu-Gi-Oh.
COLTON OGDEN: Yeah.
Yeah.
Those are all--
VERONICA NUTTING: Nintendo.
COLTON OGDEN: Those are the peak and
then they started to enter their dip.
VERONICA NUTTING: Wow.
OK.
It says, "Is a CS major at
Harvard extremely difficult?"
That's a good question.
COLTON OGDEN: You have more
insight into that than I do.
VERONICA NUTTING: I think I
maybe do have more insight.
I think with any major, there's
a way that you can do it
and it's going to be really, really
hard and very time intensive,
and then there's a way that you
can go through the major at a more
relaxed pace.
I think I'm trying to go somewhere
on the middle to more intense side.
But I think it all depends on
what you want to do after college
and what skills you think you're
going to need moving forward.
COLTON OGDEN: Are you second--
do you secondary in anything?
VERONICA NUTTING: So that's
an interesting question,
do I have a secondary, which is
the fancy Harvard word for a minor.
Maybe something like--
OK.
Maybe statistics, maybe human
evolutionary biology, maybe government.
So short answer is, totally not sure.
COLTON OGDEN: You're on the--
you're still deciding?
VERONICA NUTTING: I'm still deciding.
Yeah, we don't really
have to pick for a while.
"I speak Spanish and English."
That's great.
"What are you guys talking about?"
Currently, a bit of just intro, life.
"Grew up with the NES."
COLTON OGDEN: There's
a lot of chat today.
I'm trying to--
VERONICA NUTTING: Wow.
Wait, this is great.
Yeah.
COLTON OGDEN: I feel bad--
VERONICA NUTTING: No, no.
We're going to read through quickly.
COLTON OGDEN: Part of me
wants to go into the Python,
but part of me wants to make
sure that we're having--
VERONICA NUTTING: Yeah, we want
to stay connected with all of you.
COLTON OGDEN: "Music is pretty
good here," says V pole.
Thank you very much.
VERONICA NUTTING: Maybe
assembly language--
OK, yeah.
COLTON OGDEN: "Colton has been
doing this for a while now.
He's supposed to know this stuff."
Yeah.
Well, it's a never--
we talked about this on
the last stream, but it's a
never ending process of learning.
You will never know everything
there is to know in CS.
VERONICA NUTTING: Socrates said that.
COLTON OGDEN: Is that what he said?
[LAUGHING]
VERONICA NUTTING: Exactly, yeah.
COLTON OGDEN: Yeah.
Rajesh-- Kannah [INAUDIBLE].
Says hi.
Hello, Rajesh.
Good to have you.
Bhavik says, "Hi, Veronica."
Bhavik is a regular.
He's here almost every stream.
VERONICA NUTTING: Really?
Oh.
Hello, regulars!
COLTON OGDEN: Alioh says--
he's got the wave--
I always think that
that's an image of Erin?
It looks kind of like Erin.
VERONICA NUTTING: I thought
maybe it was an image of me.
COLTON OGDEN: Yeah.
I think I always look and see
that as Erin, waving, smiling.
VERONICA NUTTING: This emoji
does not look like Erin, Erin,
if you're watching us.
COLTON OGDEN: Nuwanda, who's
[INAUDIBLE] says, "Whoa,
it's named after Monty Python?"
She also says, "Can't join today.
About to take a plane in 30 minutes.
Just wanted to wish you guys
and Veronica a nice stream."
VERONICA NUTTING: Safe trip.
COLTON OGDEN: She's also a regular.
VERONICA NUTTING: Wow.
Nice.
COLTON OGDEN: We have a few
people here that are regulars.
VERONICA NUTTING: That's exciting.
"Is CS50 contact open source?"
COLTON OGDEN: "CS50 contact--"
Oh, "content," he said.
VERONICA NUTTING: "Content."
Yes!
Yes, it's all-- well--
COLTON OGDEN: Open source--
VERONICA NUTTING: A lot of
our tools are open source.
COLTON OGDEN: A lot of
our tools are, yeah.
VERONICA NUTTING: A
lot of our tools are--
COLTON OGDEN: I think some of them are--
VERONICA NUTTING: Under
development, yeah.
COLTON OGDEN: But all of our courseware,
all of our lectures and videos
and stuff like that, that's all open.
VERONICA NUTTING: All open, all free.
Definitely take advantage of it.
It's really a phenomenal
thing to be a part of.
COLTON OGDEN: Yeah, edX and
YouTube and other platforms.
Mkloppenburg is a regular.
"Hey, everyone."
We got a lot of people today.
"Mandarin--" oh, yeah.
So Scotty529, "Mandarin?"
No.
I do not know any Mandarin.
VERONICA NUTTING: I know no Mandarin.
COLTON OGDEN: That's a language
I do want to learn, though.
VERONICA NUTTING: I was going to
say, it's on my list of things to do.
COLTON OGDEN: Yeah,
it's so much different.
It's so hard because of the tones.
I feel like that's
such a hard language--
VERONICA NUTTING: "CS50
courses are really cool."
I agree.
Got some great courses.
COLTON OGDEN: "Python
is my go-to language.
A fair grip on it," says bhavik_knight.
Yeah, no, it's a fantastic
language for just about everything.
"I actually meant
programming languages,"
says [INAUDIBLE],, in
reference to the languages.
Yeah, yeah, yeah.
Zodiac, "I speak Spanish and English."
VERONICA NUTTING: Love it.
COLTON OGDEN: Vipulbhi says, "Sure,
let's talk about this over text."
He's got a private conversation
going with bhavik_knight.
"Pokemon is so cool."
VERONICA NUTTING: Which
was Pokemon Silver?
COLTON OGDEN: Pokemon
Silver was generation two.
So that was in '99.
So you would have been
just a baby at that point.
But that was the generation that
I think I was the most excited
about, the Gold and Silver.
Because that was right after the
first one, red and blue, right?
Which was super hype.
That's the first one, the
first generation of Pokemon.
And Gold and Silver was like, damn,
they're making it so much better.
And then they made a million
different ones after that.
VERONICA NUTTING: I would say silver
is my favorite color, or black.
COLTON OGDEN: Yeah, yeah.
They also made a Black--
Pokemon Black.
VERONICA NUTTING: Really?
COLTON OGDEN: It was in black and white.
VERONICA NUTTING: This might be
something I'm going to have to--
COLTON OGDEN: You have
to dig into a little bit,
do a little bit of research.
VERONICA NUTTING: Look into, yeah.
COLTON OGDEN: "Grew up on
NES," says mkloppenburg.
"What's been your favorite course?"
VERONICA NUTTING: "What's been
my favorite course overall?"
OK.
So I'll say CS50 and I'll also say
I took two really great classes.
One I'm taking right now,
evolutionary medicine, and I also
do a really interesting
seminar last fall
on modern civilization and
the rise of heart disease,
and I'm also taking a really
cool Russian literature class.
COLTON OGDEN: Wow.
VERONICA NUTTING: So yeah,
Intro to Computer Science,
two medicine-y classes, and
then Russian literature.
COLTON OGDEN: Interesting.
So all over the place, too.
This has nothing to do with CS50, right?
VERONICA NUTTING: OK.
So I think--
COLTON OGDEN: Directly?
VERONICA NUTTING:
Nothing to do with CS--
almost everything has to do with CS.
COLTON OGDEN: Yeah, you
can use CS in that area,
but it's not a CS oriented course.
VERONICA NUTTING: Yes.
But I think even beyond--
yeah, I know, there's
tons of applications
that I can think of analyzing Russian
literature using CS or some really
cool thing, and statistics.
But even beyond that,
I think just the way
that you train your brain
to think when you're
learning CS, that is also
applicable in the humanities
and, obviously, in the sciences.
So I found that my brain on CS is
just much better at literary analysis
and reading scientific papers.
So I think it's
absolutely all connected.
COLTON OGDEN: Have you
seen the commercial,
like, this is your brain on
drugs, and she smashes an egg?
VERONICA NUTTING: No.
[LAUGHING]
COLTON OGDEN: I just thought about that
because you said, "my brain on CS."
Like, this in my brain on CS.
VERONICA NUTTING: That's cool.
OK.
COLTON OGDEN: Not that it has the
same effect on your brain at all.
Quite the opposite, actually.
It's a funny little thing that popped--
VERONICA NUTTING: I just
think it changes how you think
and how you process everything and
how you can bring things together.
I think it's always
very exciting to feel
like I'm one of a few people that
studies CS in a humanities classroom,
because I do think it gives
me a different perspective.
COLTON OGDEN: Do you
know the meme where it's
the brain with different levels
of electricity or whatever?
VERONICA NUTTING: Yes, I
do know what that means!
COLTON OGDEN: That's your brain on CS.
VERONICA NUTTING: That's my brain on CS.
COLTON OGDEN: There we go.
VERONICA NUTTING: OK.
Yeah, the brain on CS.
COLTON OGDEN: Andre's a regular.
He's also a prominent figure
in the Facebook group.
He says, "Hi, Colton and Veronica."
Hi, Andre.
VERONICA NUTTING: Go all of you.
Yeah.
That's so wonderful to see.
I hope to interact with you more often.
This is exciting.
COLTON OGDEN: Jeffrey
Hughes says, "Hey."
Jeffrey Hughes has been on quite a lot.
VERONICA NUTTING: Hey there.
COLTON OGDEN: Vipulbhi says,
"Yu-Gi-Oh is a great game and a show."
I haven't played much or seen much
of it, but it was very famous--
VERONICA NUTTING: Is that
how you spell Yu-Gi-Oh?
Wow.
COLTON OGDEN: Yes, it is.
Yeah, there's some capitalization
in there in the actual--
VERONICA NUTTING: OK.
COLTON OGDEN: Leulyakot
says, "Hey from Ethiopia."
That's the first time that
I think we've seen you,
so thanks for joining us today.
VERONICA NUTTING: That's so cool.
OK.
My best friend is half
Ethiopian, so welcome.
COLTON OGDEN: Oh, nice.
Yeah, we have people
from all over the world.
It's fantastic.
VERONICA NUTTING: That's so exciting.
COLTON OGDEN: Oh, yeah.
Mkloppenburg tossed their
GitHub into the chat.
Nice.
VERONICA NUTTING: Nice.
Awesome.
Thanks.
COLTON OGDEN: Rajesh,
"Machine learning--
I'm interested to learn the
content available in CS50."
Yeah, so if you haven't
seen the stream already,
Nick and I did a stream two weeks
ago-ish, where he built a simple binary
classifier in TensorFlow.
So if you want an intro
to that-- and I think
we're going to do a
more from the ground up
machine learning stream at some point.
VERONICA NUTTING: That's exciting.
COLTON OGDEN: Yeah, because that
one was basic but somewhat involved.
So definitely check that out.
VERONICA NUTTING:
TensorFlow's super cool, yeah.
And Nick is great.
Highly recommend it.
Definitely go watch that stream.
COLTON OGDEN: Yeah.
Most of it just went past my head.
I was like, I've gotta dive
into this at some point.
"Maybe up to Pokemon Yellow, too.
I'm not sure," says Stay Peaceful.
"Do you want to be a
doctor?" says Scotty.
VERONICA NUTTING:
That's a great question.
I get this a lot.
I have a lot of professors that are
like, you'd be such a great doctor.
Honestly, I think being a
doctor is just really hard
and I'm not sure that
I could or would want
to spend so much of my time in such
an intense environment as a hospital.
That being said, I'm
fascinated by medicine
and have the greatest respect
for the medical community,
although we should always be
critical of every community.
No, but I love medicine.
I don't want to be a doctor, no.
COLTON OGDEN: It's not hard
necessarily in the technical sense,
but more the emotional weight.
VERONICA NUTTING: Yeah.
I think also, in the
technical sense, I just
think it's such an
incredible thing to know,
especially so young, that you
want to devote your life to.
And I think I'm a person that's
totally out the other end that's
quite well-rounded and interesting
in a bunch of different things.
So the idea of devoting my life
to one path, and especially a path
as intense and charged as a
doctor is quite a big step
that I'm not currently
planning on taking.
But I love doctors and I love vets.
COLTON OGDEN: Yeah, that makes sense.
That's something that I
feel like you probably
would want to make that kind of
decision later, or at least once you--
VERONICA NUTTING: It takes a special,
really strong, really brilliant person
to want to go into medicine as a nurse
or doctor or anything in that field.
COLTON OGDEN: That makes sense.
That makes sense, yeah.
I don't know if I would
ever want to do that either.
I wouldn't want to do it
for the emotional weight.
VERONICA NUTTING: Yeah.
COLTON OGDEN: I feel like that
would be hard for me to deal with.
"I'm here for the spam,"
says President of Mars.
"Here for the spam."
And then is that a Monty
Python reference, as well?
Because isn't spam one of
the Monty Python skits?
Am I getting that right?
VERONICA NUTTING: Oh.
It is.
It is, it is.
So an interesting thing
about Monty Python.
So actually, I prefer
their movies, which
is a bit of a controversial thing.
A lot of people prefer--
they do skits or did skits,
and then also have the movies.
So I'm less familiar with the skits.
But I think they do have
a very famous spam one.
And then that little thumbs up--
I'm not sure who that person is.
COLTON OGDEN: That's
called the seems good.
Seems good.
VERONICA NUTTING: Seems good.
OK.
COLTON OGDEN: And then nishthegamer
says, "I'm here for Colton's hair."
Thanks for your support.
VERONICA NUTTING: I am also
here for Colton's hair.
COLTON OGDEN: Thank you.
VERONICA NUTTING: Is that all natural?
COLTON OGDEN: It is not all natural.
Well, in the sense that
I'm using product, yeah.
It's not a-- so it's got stuff in it.
VERONICA NUTTING: OK.
That's squishier than I thought.
COLTON OGDEN: Oh, you thought
it was going to be crusty?
VERONICA NUTTING: I did, yeah.
COLTON OGDEN: Thankfully not.
Rajesh says, "I found
binary classifier in CS50.
Thanks, guys."
Oh, yeah.
Nice.
Yeah, definitely check that out.
And again, in the future we'll
be doing a little bit more--
hopefully a little bit more from a
ground up machine learning stream.
We have to talk through the details.
We had so many ideas that came out of
the last stream, it was ridiculous.
We were talking about
ideas for 30 minutes.
VERONICA NUTTING: Really?
COLTON OGDEN: Yeah.
VERONICA NUTTING:
About possible streams?
COLTON OGDEN: Yeah, yeah.
Like, Control the Flag--
so there's this thing--
I didn't know about it--
called CTF, Capture the Flag,
sorry, where you have to find
a string on someone's system,
and it's hidden somewhere in a
very, very hard to find spot.
It's for white hat
hacking kind of stuff.
VERONICA NUTTING: So cool.
COLTON OGDEN: Nick is
super into that stuff.
VERONICA NUTTING: Nick Long?
COLTON OGDEN: Yeah.
VERONICA NUTTING: Oh, my goodness.
COLTON OGDEN: No, he's brilliant.
VERONICA NUTTING: He's in my
Systems Programming class.
COLTON OGDEN: Yeah, he knows everything.
It's amazing.
VERONICA NUTTING: That's really great.
COLTON OGDEN: Yeah, no, it's fantastic.
All right.
Sashikant, "So a little
more of Python 2."
So why don't we take that as our first--
VERONICA NUTTING: Yeah,
let's jump right in.
COLTON OGDEN: --step to
looking at some Python stuff.
So I'm going to bring up your screen.
Is that OK?
VERONICA NUTTING: Yeah, let's do it.
So we promised you all 100
cool things about Python.
And we're going to start
a little bit basic today,
and then we're going
to build up hopefully,
again, over the course of
a handful of more sessions.
So throughout this
stream, definitely let
us know what you want to learn
because we're very curious.
We can cater this experience
to whatever you're thinking.
And yeah, let's just jump right in.
I think I first wanted to start
off with a cool discussion of very
basic Python data structures.
And then I have this
slightly political activity.
COLTON OGDEN: Oh, man.
I'm very excited.
I'm curious to see it.
VERONICA NUTTING: Yeah.
It's basically like, we need more
subversity in the White House.
COLTON OGDEN: Sure, yeah.
VERONICA NUTTING: So let's take a
look at who we've had as presidents.
COLTON OGDEN: Oh, man.
I wonder what the distribution's
going to look like.
VERONICA NUTTING: OK.
And then question-- should we wait
for input at every step or do we just
jump--
COLTON OGDEN: Oh, no.
People will definitely
contribute to the chat.
And we will probably not get
through 100 things today.
We'll probably get through a
much smaller number than that.
But like Veronica said, the
plan is to have more of these
and eventually have a corpus of 100
or so things that we talk about.
Just because it's hard to talk about--
fit 100 things into--
VERONICA NUTTING: Oh, my gosh.
Yeah, in one session.
COLTON OGDEN: --a two-hour or three-hour
stream and not interact with--
even if we didn't
interact with the chat,
it would still be impossible almost.
VERONICA NUTTING: Oh, and
something I thought of as well--
I think that's what makes
this experience quite special,
is that we are talking through
with you every step of the way.
It's not just a YouTube video
that you found and stumbled upon
and are going to watch
and forget about it.
It's something where--
it's a conversation really,
which is really exciting.
COLTON OGDEN: Mkloppenburg says, "What?
Not 100?
Click bait!"
Yeah, a little bit, almost, right?
VERONICA NUTTING: Almo--
there's a small or so nestled
in there somewhere, I think.
Maybe in the description.
But again, it's 100 over
the course of n sessions.
COLTON OGDEN: Yeah, n sessions.
Yeah, exactly.
VERONICA NUTTING: Lol.
COLTON OGDEN: And it
gives us a perfect chance
to have you back with us multiple times,
which is, of course, the main goal.
VERONICA NUTTING: The main goal.
COLTON OGDEN: "Good things take time,
mkloppenburg," says bhavik_knight.
Exactly, exactly.
VERONICA NUTTING: Oh, wow.
[LAUGHTER]
COLTON OGDEN: Nicholai123--
hey, that's inappropriate,
Nicholai, that's inappropriate.
VERONICA NUTTING: This
is a kid friendly show.
COLTON OGDEN: It's supposed
to be kid friendly.
VERONICA NUTTING: Oh,
you have no filter.
COLTON OGDEN: There's no filter now.
People can basically
say whatever they want.
We're kid friendly,
that's the important part.
VERONICA NUTTING: We're kid friendly.
COLTON OGDEN: Yeah,
we need a disclaimer--
VERONICA NUTTING: If your kid can read--
COLTON OGDEN: Does not
apply to people in the chat.
VERONICA NUTTING: It does not
apply to people that can read.
COLTON OGDEN: And I'm going to
start trying to get better at this.
I have a follower widget now
that basically tells us when
we have a new follower in the stream.
And so we have N3demos--
it's loading again.
No, sorry, Z3demos, or Zedomos.
Thank you for the follow.
"Print weewee," says Nikolai there.
There we go.
Adam Fighter 10101, "Print 20
peanuts," "20 times peanuts."
VERONICA NUTTING: 20--
I'll just do peanuts.
COLTON OGDEN: But then you have
to multiply that by 20, I think.
VERONICA NUTTING: Peanuts?
COLTON OGDEN: P-E-N-U-T-S. I'm not
sure where we're going with that, but--
VERONICA NUTTING: Just
gotta start somewhere.
COLTON OGDEN: Yeah.
You can do that just in the
Python interpreter even.
Yeah so we bring up Python 3
and then type print peanuts.
And then you can multiply
that string by 20.
VERONICA NUTTING: Really?
Just like that?
COLTON OGDEN: Yeah.
And then that will
actually print it 20 times.
So there's a cool thing
you can do in Python.
VERONICA NUTTING: OK.
Sure.
COLTON OGDEN: Python supports
multiplication of strings.
And so what it will do is we'll just
concatenate them together and form
a new string.
So there's one thing--
there's a cool thing.
Oh, Adam Fighter says,
he misspelled peanut--
or he or she misspelled peanuts.
VERONICA NUTTING: No-- oh, OK.
In the comments or in the--
this is definitely
how you spell peanuts.
COLTON OGDEN: It is.
What happened?
This is so cool--
oh, you forgot the parenthesis.
There we go.
That's OK.
But yeah.
Isn't that nice?
That's a cool thing about Python.
A lot of people don't
necessarily know about that.
So if you want to do--
what is it?
Mario.
There's something-- it's not Mario.
What is it?
Somebody did it in [? HBAP. ?]
They were able to print something.
Rather than using a nested for loop,
they just used string multiplication.
VERONICA NUTTING: Oh, that's cool.
COLTON OGDEN: Yeah.
VERONICA NUTTING: Oh, that's very cool.
OK.
That's exciting.
Have any of you--
OK.
What is--
COLTON OGDEN: Adam Fighter's
saying that print 10--
hashtag print smiles.
VERONICA NUTTING: What a nice audience.
Also, OK, fun thing.
I don't know if anyone caught
this, but my last name is Nutting.
So I always get all
these jokes about nuts.
COLTON OGDEN: Yeah.
VERONICA NUTTING: I have a--
COLTON OGDEN: Hopefully
you're not allergic to nuts.
VERONICA NUTTING: I am not.
I have no allergies.
COLTON OGDEN: That would
be the most ironic thing.
VERONICA NUTTING: Actually, I
feel like I ask that question
to a lot of people as an ice breaker.
I'm like, do you have any allergies?
And occasionally I'll get someone
that's like, I have a deathly--
I have a very severe allergy.
Please don't treat this lightly.
So I'm sorry if--
COLTON OGDEN: Yeah, that's true.
VERONICA NUTTING: --a severe--
OK.
Printing some smiles.
OK.
We'll go ahead and print 100.
COLTON OGDEN: Osman_ahmed says,
"Thank you guys for the live streams.
I follow them from time to time."
Yeah, thank you for joining us.
President of Mars has got the--
I'm actually not sure
what that emoji is.
Cox ice-- Jesse Cox.
I'm not sure if that's Jesse Cox.
Mkloppenburg, "So what's going on here?"
Oh, I see.
Nutting."
He gets it.
He sees your name.
Did you have it--
oh, yeah.
He was lost.
I think he said Nutting.
He didn't realize your
last name was Nutting.
VERONICA NUTTING: He didn't realize my--
OK.
Yeah.
COLTON OGDEN: I think we did
say it at the beginning, though.
VERONICA NUTTING: I
feel like we said that.
I also think it's in the
description somewhere.
COLTON OGDEN: It is in multiple
places-- multiple descriptions, yeah.
"If self.Nutting, which is the--" OK.
That's inappropriate, Nikolai.
We've got to calm--
we got to bring--
I've got to stop reading these out loud.
VERONICA NUTTING: Yeah, if people
aren't good to filter themselves,
then we need a filter.
COLTON OGDEN: Yeah, I know.
I'm trying.
I'm trying my best.
VERONICA NUTTING: It's
always like-- it goes
in a couple of different
directions, the last name thing.
COLTON OGDEN: Yeah.
VERONICA NUTTING: But I
just felt-- because we had--
we were talking about nuts.
COLTON OGDEN: Yeah.
Well, at least that's out there.
We've broken that.
VERONICA NUTTING: We've
broken that, yeah.
COLTON OGDEN: We've broken that ice.
VERONICA NUTTING: Gotten
that out of the way.
And then-- yeah, no, I have a
pseudonym that's Victoria Pecan.
Because people call me Victoria.
They just mess up my name
and call me Victoria.
And then Pecan because of Nutting.
COLTON OGDEN: I get it.
It's very sophisticated humor.
VERONICA NUTTING: Thank you, yeah.
COLTON OGDEN: Yeah.
VERONICA NUTTING: All right.
Anything else we want to show in--
COLTON OGDEN: I can't
think of anything--
oh, I guess while we're talking
about strings, maybe format strings.
Because I'm not sure if people are super
familiar with what format strings are,
which is a Python 3.6 feature.
So you can actually type in
F in advance of a string,
and then that will allow you to insert
a variable in curly brackets, which
will allow us to--
it functions as a template--
a string template.
But they're called
format strings in Python.
They're called templating--
or what are they called?
Template literals in JavaScript.
VERONICA NUTTING: Yeah, so you're
seeing a very basic example.
So if any of you have seen
or tinkered around with C,
you'll know that if we wanted to do
this in C, we'd have to do hello there,
percent I, some sort of place
holder, and in this case, 5,
and we'd print it that way.
But imagine if you wanted
to print out a string
and you had a ton of place holders.
This could get really messy, right?
So I could do hello there.
My numbers are percent I,
percent I, percent I, et cetera.
COLTON OGDEN: And you
could have an S one,
like, hello something before that
even to make the string even more
complicated.
VERONICA NUTTING: Hello--
yeah, that's a great point.
This is one of those things
that as the language evolves,
we start making all these decisions
to make it more reader friendly
and then just make it clearer, right?
Again, so let's take a look at this.
So even this right now is already
starting to get a tiny bit messy.
I'll throw in a float.
COLTON OGDEN: Just to be fancy.
VERONICA NUTTING: Oh, no.
I keep accidentally-- oh, this is also--
this is C, so this
isn't going to compile.
But this is what it would look like.
Like, Veronica--
COLTON OGDEN: Getting perspective.
VERONICA NUTTING: Yeah,
getting perspective of how ugly
this would be in a different situation.
COLTON OGDEN: It's already
making me a little bit sick.
VERONICA NUTTING: Yeah.
And then I'll do 7.5.
So I'd have to print out
this ugly thing and see.
Whereas in Python and in
this version of Python,
which you're using, which,
again, is Python 3.--
I think you said 3.5.
COLTON OGDEN: I use 3.7.
You can see which version you have.
If you open up Python,
it'll tell you immediately.
VERONICA NUTTING: Like, Python--
COLTON OGDEN: You can just do Python 3.
Just type in Python 3.
And then there it says 3.7.
VERONICA NUTTING: 3.7.
COLTON OGDEN: Compiled with Clang 6.0.
Or it's using Clang 6.0 in
the back end for something--
I don't remember.
I don't' remember what
the Clang bit is there.
VERONICA NUTTING: How many Python
versions do you keep on your computer?
COLTON OGDEN: I have two.
So I have 2.7 and 3.7.
VERONICA NUTTING: Do I have 2.7?
COLTON OGDEN: If you just type
Python, that should just be your 2.7.
Yeah.
VERONICA NUTTING: Interesting.
COLTON OGDEN: [INAUDIBLE]
Scotty says, "Keep this PG."
bhavik_knight says,
"Keep it PG, please."
I appreciate the humor.
I think if this were my own
stream, I'd probably be less--
VERONICA NUTTING: Who's today's guest?
It's Veronica.
COLTON OGDEN: Oh, yeah.
It's Veronica-- Veronica Nutting.
So she introduced herself earlier.
But she's head CA.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Also, our Spanish
translator for our Spanish initiative
that we're trying to--
VERONICA NUTTING: Yeah,
we're taking CS50 to--
I think it's 500 million
people that speak Spanish.
COLTON OGDEN: That's a lot of people.
VERONICA NUTTING: I think
it's a lot of people.
COLTON OGDEN: Is that number three?
VERONICA NUTTING: I think it's--
I was just talking about this.
I think it's number three in
terms of natives speakers.
COLTON OGDEN: I would imagine
English, Chinese, Spanish.
VERONICA NUTTING: Yes.
But that would be non--
I think it's actually--
I think there are a couple more
when you do total speakers,
but native speakers-- because there are
more total English speakers than there
are total Spanish speakers, but there
are more native Spanish speakers
than there are native English speakers.
COLTON OGDEN: That makes sense.
VERONICA NUTTING: That made sense?
So if you're looking at the biggest
languages in terms of native speakers,
Spanish is--
I think it's number two or three.
COLTON OGDEN: Yeah, that makes sense.
It's hard to compete
with Chinese, though.
You're competing with 1.something--
two billion people-- one or two
billion people, which is insane.
VERONICA NUTTING: Do
I like Buenos Aires?
I love, love Buenos Aires.
It's such a cool city.
It's great.
Yeah, I highly recommend.
Although, people-- a tiny tangent.
Someone recently was talking about
Brazil and they were like, oh, yeah--
it was about a book set in Brazil.
And they were like, oh, yeah, the
main character lives in Buenos Aires.
And I was like, that's
Argentina, not Brazil.
COLTON OGDEN: So clearly
a non-native speaker--
non-native writer.
VERONICA NUTTING: Just look at America.
COLTON OGDEN: Which is hilarious.
Who wrote the book?
Who wrote the book?
VERONICA NUTTING: [INAUDIBLE] something.
It was a cool, new book that they
picked up at Lamont-- out of our library
that was a new and upcoming author.
And I was like, oh, that's a cool cover.
What's the book about?
And then they were like, oh,
it's set in Brazil, blah, blah.
And then I look at the back
cover and the first part
is like, in Buenos
Aires, blah, blah, blah.
And I was like, pretty
sure it's set in Argentina.
COLTON OGDEN: You just
immediately starting cringing.
Oh, English, Chinese, and Spanish.
There we go.
We were right.
It's beautiful.
High-five.
VERONICA NUTTING: English, Chinese,
and Spanish native or total speakers?
COLTON OGDEN: Probably
total speakers, honestly.
I think English is probably the--
VERONICA NUTTING: Zodiac--
COLTON OGDEN: Yeah, Zodiac--
VERONICA NUTTING: Like Zodiac Killer?
COLTON OGDEN: Not Zodiac Killer.
We'll not give him that.
Zodiac X.
VERONICA NUTTING: Him or her, yeah.
Zodiac--
COLTON OGDEN: Zodiac
is a regular, though.
We see him or her--
I'm not sure.
But we see them a lot.
VERONICA NUTTING: Interesting.
"I'd assume total."
Yeah.
COLTON OGDEN: And mkloppenburg,
"List of--" oh, there we go.
"List of languages by native speakers."
It would be on my computer.
But if we go down here,
number one, OK, Mandarin.
Spanish, number two.
VERONICA NUTTING: Boom.
COLTON OGDEN: There we go.
You had it.
You were right on the mark.
But yeah, it's hard
to compete with China.
Look at that.
What's that?
200% higher?
Or not 200%.
300% higher.
Yeah, pretty crazy.
VERONICA NUTTING: That is really crazy.
OK.
That's exciting.
Yeah.
So again, I think the motivations for
CS50 moving in the Spanish direction
are quite clear.
And then I think, yeah, the world
is our oyster in terms of languages.
COLTON OGDEN: We have to
consider our Mandarin port, too.
Do you want to learn Mandarin and then--
VERONICA NUTTING: I want to
learn Mandarin, Russian, Arabic.
The list of languages I want to learn--
COLTON OGDEN: I was going to ask you
since you were doing Russian literature
if you knew Russian yet?
Do you know how to read
Cyrillic, the script?
VERONICA NUTTING: No.
I'm working on it.
The short answer is no.
I think it's one of those
annoying things that
reading Russian literature
in English, you just
can feel that it's not the same.
I wish I could read it in Russian.
COLTON OGDEN: All I
know about Tolstoy and--
who else?
There's another really famous Russian--
VERONICA NUTTING: Babel, Pushkin.
COLTON OGDEN: No, not those ones.
VERONICA NUTTING: Gogol.
COLTON OGDEN: Those are all--
I'm sure they're all very famous.
VERONICA NUTTING: Novikov.
COLTON OGDEN: I just
don't happen to know them.
There's another really famous
one that I just don't remember.
VERONICA NUTTING: OK.
What have we got there?
COLTON OGDEN: "What programming
environment are you guys on?"
VERONICA NUTTING: Oh, Atom.
COLTON OGDEN: So you're using--
OK.
Right.
Yeah.
VERONICA NUTTING: Yeah, I'm using Atom.
COLTON OGDEN: We didn't
discuss that at all.
You're using integrated
terminal, it looks like, as well.
VERONICA NUTTING: Yep.
COLTON OGDEN: Is that through a plugin
or is that just part of Atom now?
VERONICA NUTTING: It's through Atom--
all through Atom, one of the packages
you can install using mainly Python 3
because I think--
I don't know, we're a little bit
more comfortable with Python 3.
But do you have a sense
of when you personally
use Python 2 versus Python 3?
COLTON OGDEN: I don't use
Python 2 ever anymore.
I switched to Python 3 completely in
2016 when we made the switch to Python.
And mostly-- I think it
was format strings, where
the one piece where I
was like, I really can't
deal with not having these anymore.
VERONICA NUTTING: Yeah, let me try--
OK.
COLTON OGDEN: Sorry, we have
some other comments here.
"edX course for Mandarin," says JP Guy.
Oh, yeah.
Did I miss saying hi to
JP Guy when he came in?
I don't remember.
I saw JP Guy waving.
Says, "Who's today's guest?"
Oh, yeah.
We said, who's today's guest.
Yeah, JP Guy's a regular.
VERONICA NUTTING: I think I remember--
COLTON OGDEN: Oh, Rahul
says, "Try Hindi."
Hindi's also a huge, huge language.
Population of India is massive, right?
VERONICA NUTTING: We just saw it, yeah.
COLTON OGDEN: It's on this list.
Number four.
Yeah, number four.
Yeah, that would be a
great endeavor, as well.
So we should think about doing that.
VERONICA NUTTING: What's
the format for Python 2?
COLTON OGDEN: It was string.format.
So you would do something-- yeah,
so you would do the percent.
So type in--
I'll write it here and
then you can replicate it.
So Python-- if I do this--
so you would do something
like Veronica and then
you would have an S
like that in the string.
And then you would--
VERONICA NUTTING: There's the
present sign or something.
COLTON OGDEN: Yeah, just like that.
VERONICA NUTTING: Oh,
that's horrible, yeah.
COLTON OGDEN: So you could do--
you wouldn't do string.format, though.
So string.format, it was a-- so the dot
format is a function on string objects.
VERONICA NUTTING: And then
interpreters, you can go directly.
COLTON OGDEN: You could do just a string
literal that says Veronica percent s.
So this is--
VERONICA NUTTING: Place holder, yeah.
COLTON OGDEN: Exactly.
VERONICA NUTTING: OK.
COLTON OGDEN: And then you
would do the percent sign,
and then you would do
the argument to that.
So Newbie Boy, thank you for the follow.
And then you would pass in
the argument, and exactly,
get the string templatized-- or, I
guess, populated with-- the template
gets populated with the argument, and
then that is your completed string.
VERONICA NUTTING: Interesting.
Yeah, it's always a weird--
there's always a sense of
like, is it important to know
earlier versions of languages?
COLTON OGDEN: If you have to do
back porting-- or not back porting,
but if you have to do
with legacy code, I
would say that's probably
the main use case.
VERONICA NUTTING: Oh, legacy code.
You mean code remnant from--
COLTON OGDEN: Yeah.
So let's say CS50 has a major
app that would be just a pain
to add features to, but it
was written in Python 2.7,
and now you have to go
and make changes to it.
So it actually helps you to try to know
how Python 2's string templating worked
back in 2.7 versus--
and then even in 3, you would
do something like, Veronica--
and then it was something weird.
It was like this, and
then you do dot format.
And then in there, you would
actually pass in your argument.
VERONICA NUTTING: Wait,
this is Python what, though?
COLTON OGDEN: I believe
this was in Python 2 and 3.
I think it was--
VERONICA NUTTING: OK.
Like a transitionary--
COLTON OGDEN: Python string format.
I'm just verifying exactly
when they released it.
I think it was 2 and 3.
Because this was-- yeah,
this was in Python 3
before format strings came out.
VERONICA NUTTING: OK.
So that does seem to--
COLTON OGDEN: And you would
pass in these empty brackets
that you can populate
with format specifies.
You could say, like, 0.2
F or whatever to say,
oh, I want this to be
rounded or displayed
to two decimal points or whatever.
VERONICA NUTTING: Yeah.
COLTON OGDEN: And then
you would pass in whatever
arguments in a variable length
within the format function itself.
And you just call that on any string.
Because it's part of the string class,
so any string object has that function.
So any literal string has that format
function, which is pretty cool.
VERONICA NUTTING: Very cool.
Yeah, legacy code.
COLTON OGDEN: So this
is the legacy version.
So obviously, now you can appreciate
why the F strings are so much cleaner.
VERONICA NUTTING: It's a little clear.
Yeah, wow.
COLTON OGDEN: When this first
came out in Python 3.6, I was--
I tried my hardest to get David on
board with it and he resisted at first.
VERONICA NUTTING: Really?
COLTON OGDEN: But he came around.
And I think now he's very warm
with the F string paradigm.
Let's make sure that I didn't
miss any comments here--
we didn't miss any comments here.
"Chekhov," is what KeithSH says.
So, Keith, thank you for joining us.
"I don't mean to be rude.
Can we get to Python?" says Scotty.
Oh, yeah, sorry.
Yeah, no, we just started now.
But let's make sure--
VERONICA NUTTING:
Trying to learn Russian.
COLTON OGDEN: "It's complicated for me.
Try Hindi.
It's an easy one.
Tell the interpreter to print a string
by explicitly declaring percents,"
says Rahul.
Yeah, exactly.
And then-- so bhavik
has a suggestion there.
So he's got a string.
You could do it the same way.
You can specify a list, right?
VERONICA NUTTING: OK.
COLTON OGDEN: So what
bhavik did, he specified
a list called l, which gets three
different arguments, this, is,
and then CS50 TV, all
separate ones there.
VERONICA NUTTING: OK.
I think I want spaces, actually.
COLTON OGDEN: Oh, yeah.
Well, no, because I think what it
does is you put spaces in the literal
that you format--
or the template that you format.
So this is another way that
you can use format strings
using the older paradigm, so using also
argument unpacking, which we'll see.
So you can-- yeah, so then
you have the template there.
VERONICA NUTTING: Can we do that?
COLTON OGDEN: Yep, exactly.
So you have three of those place holders
in the string, dot format-- you're
calling dot format on the
string object, and then you're
passing in using the star
operator, which unpacks arguments.
So you have a list of arguments.
You can unpack them into a function
and it will put them in separated
by commas, basically, just like that.
Then you get, this is CS50 TV.
So thank you, bhavik, for that.
VERONICA NUTTING: That's very cool.
COLTON OGDEN: Bhavik also says,
"F strings are the coolest."
So that's multiple things.
VERONICA NUTTING: OK.
Coolest.
COLTON OGDEN: Using legacy format
template with the dot format function,
but also argument unpacking, which
you can see here is super nice.
You could programmatically
assemble a list of arguments
if you know that your function is--
what's the word for it?
Variadic, meaning that it
can take multiple arguments--
variadic functions.
And so in this case, if you
have a variadic function,
you can assemble your
list programmatically
or through some meaning--
through some function
or through some code,
and then pass it in with unpacking.
VERONICA NUTTING: Oh, that's very cool.
COLTON OGDEN: Cool.
VERONICA NUTTING: OK.
Awesome.
COLTON OGDEN: Thanks, bhavik.
Appreciate that.
"That's pretty advanced," says JP Guy.
A little bit.
But it's not too advanced, right?
VERONICA NUTTING: It's
all stuff you can do.
Yeah.
COLTON OGDEN: There's simple
pieces we're putting together.
We have lists.
So the list is--
I guess we didn't really
talk about what lists are.
VERONICA NUTTING: Is it variadic?
COLTON OGDEN: Variadic
with a D. There we go.
Nice.
And then there might be a slight--
because variadic is something you
see in functional programming,
there might be a slight
connotation that's
specific to functional programming.
But it's the idea that you
have multiple arguments.
And then so the list is--
you get a list--
I guess we should show some of the
different data structures in Python.
VERONICA NUTTING: Yeah, let's do it.
COLTON OGDEN: That would
be something worth doing.
VERONICA NUTTING: OK.
COLTON OGDEN: "I'll have to check if
C# has something similar," says JP Guy.
I'm not familiar offhand with
the string-- because in C#,
you can add strings
together with a plus.
VERONICA NUTTING: Yeah, concatenation.
COLTON OGDEN: Yeah, exactly.
String concatenation.
VERONICA NUTTING: We
can do that in Python.
COLTON OGDEN: Yeah, yeah, exactly.
Java lets you do that, too.
C++ and C do not let you do that.
You actually have to use
functions to assemble strings.
C makes life a little bit trickier.
But I don't know if there are any other
fancy functions that take multiple
arguments like in C#.
Scotty says, "Colton, would you
consider working as a software engineer
at somewhere like Google or Facebook?"
VERONICA NUTTING: Are you a recruiter?
COLTON OGDEN: I would consider it.
It would be very--
I feel like that would be very
difficult and very stressful.
It depends on what the
project is, I think.
"Try a star-like pattern of your
string, please," says Rahul.
VERONICA NUTTING: A star-like pattern?
COLTON OGDEN: Could you elaborate
on what you mean with that, Rahul?
VERONICA NUTTING: I assume you mean--
I'm sure there is a way
that we can print out,
like, a smiley face if we
print out enough rows that
are format in a special way.
COLTON OGDEN: Like,
ASCII art type thing.
VERONICA NUTTING: Yeah.
Off the top of my head, I
can't think of a pattern
that will produce a super fun one.
But we can--
COLTON OGDEN: I think he might
be referring to the argument
unpacking that we demonstrated
earlier with the asterisk.
VERONICA NUTTING: OK.
Yeah.
COLTON OGDEN: I'm not sure
what he's referring to.
Oh.
Andre says, "C++ doesn't let you
concatenate strings with plus.
The standard string is
actually also mutable,
so you can plus equals stuff to
attach them at the end of the string."
So it's called using
operator overloading,
meaning that they've defined
new behavior for plus.
You can actually
concatenate the STD string--
so from the standard
library, the string object,
you can actually concatenate those.
So I do now--
I am recalling that.
I think I'm contrasting that
with string literals, which are,
I believe, underneath the hood, just
char stars, just like they are in C.
VERONICA NUTTING: Just
like they are in C.
COLTON OGDEN: So that's what
I'm getting it confused with.
VERONICA NUTTING: Interesting.
COLTON OGDEN: Looks like Adam
Fighter has another suggestion.
So a person--
VERONICA NUTTING: Sure.
COLTON OGDEN: Oh.
This is a perfect segue
into-- we were going
to talk about different
data structures in Python.
VERONICA NUTTING: OK.
Wonderful.
COLTON OGDEN: So a list--
why don't we talk about,
maybe, a list, for example.
We saw lists earlier.
VERONICA NUTTING: Yeah.
So I'm just going to create a list.
COLTON OGDEN: And you
have some stuff that we're
going to look at in a while
that actually uses lists.
VERONICA NUTTING: We're going to bring
in a couple different data structures
and see how we can do some
fun manipulation of data,
which will be exciting.
OK.
So what are some things
that you know about lists?
Let's talk about lists.
So one important thing about
lists is that they have order.
What does it mean for
a list to have order?
Well, it means that we can
index and find specific elements
in a list based on their
position within the list.
COLTON OGDEN: Just like a raise in C.
VERONICA NUTTING: Just
like a raise in C, yes.
That's a great way to think about it.
So here I'll create a list of--
colleges?
I'll create a list of colors.
Purple, orange.
These are all my least favorite colors.
COLTON OGDEN: All the ones
with the hardest rhyming, too.
VERONICA NUTTING: True.
Yeah, any time I don't like
something, I try to like it.
Because--
[LAUGHS]
I think it's easier to like everything.
So what's another color
I don't like that much?
Periwinkle.
COLTON OGDEN: Is that like a weird blue?
VERONICA NUTTING:
Periwinkle's-- is like lavender.
Periwinkle and then--
COLTON OGDEN: What am I
getting it confused with?
VERONICA NUTTING: Mustard.
COLTON OGDEN: Oh, this is it.
Oh, it's cornflower blue.
That's what periwinkle is, I think.
VERONICA NUTTING: Cornflower blue?
COLTON OGDEN: I think so.
See, here we go.
Here's a picture of it.
I'll let you contrast it.
Periwinkle and then cornflower blue.
They're basically the same color, right?
VERONICA NUTTING: They are
basically the same color.
COLTON OGDEN: So fun fact.
Periwinkle and cornflower
blue are the same.
That's another cool thing not in
Python, but it's a cool thing--
cool piece of information.
So you have a list.
OK.
VERONICA NUTTING: Pretty
straight forward list.
We've just printed it.
Nothing crazy.
COLTON OGDEN: So this is something
you wouldn't be able to do in C.
You wouldn't be able to just take
an array and say, print this array.
VERONICA NUTTING: Yeah, no.
COLTON OGDEN: I think it would
literally print the memory
address where the array pointer is.
VERONICA NUTTING: The char star, yeah.
The first one, yeah, which is great.
We can just print it directly.
OK.
"A raise in CR a fixed length--" can
we go back to the comments real quick?
COLTON OGDEN: Oh, Userman.
Yeah.
VERONICA NUTTING: More of a
homologous, like structure.
COLTON OGDEN: They are not
comparable in the same sense where
they're fixed in size.
Lists do expand.
Lists are more like link lists.
VERONICA NUTTING: Yeah.
That's a better comparison.
COLTON OGDEN: But the indexing part of
it is more of what we were getting at,
where they have a fixed
order and you know
where the elements are, as opposed to
something like a dictionary in Python.
VERONICA NUTTING: Or a set, which
are unordered data structures.
COLTON OGDEN: Exactly.
VERONICA NUTTING: And we'll
get into those in a bit.
But ordering is this
really incredible power--
like, a super power.
Yeah, when you have something
that's ordered, all of a sudden you
can directly go and
access a specific element
without having to search
through to find it.
COLTON OGDEN: Yeah, which
would be o of n time.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Because then you're
going through your entire list.
VERONICA NUTTING: Exactly.
COLTON OGDEN: o of n
being the complexity
of the operation of going through a
list, actually searching through it.
So that would be called linear search.
VERONICA NUTTING: For sure.
COLTON OGDEN: Which is not
usually the most efficient way
of searching for something in
a set of a million integers.
If your worst case is a million
cycles of your algorithm, not ideal.
VERONICA NUTTING: Is it Halloween?
Because linear time
complexity is spooky.
COLTON OGDEN: Wow.
There we go.
VERONICA NUTTING: No, but OK.
A metaphor I usually use in this
time is like, let's say I said, hey,
would you please go get
this book from the library?
And I give you it's
Dewey decimal number.
You know exactly where to go.
You go and you're like, OK, boom, I know
exactly what section I need to go to.
You know exactly where
that book is going to be
and you can be in and out of
the library in two minutes.
Now if I say, hey, please find this
book and I just give you a title
and this is a library that has no order.
All the books are jumbled up.
You'd have to go through each
book one by one and look and try
to find the book I'm asking
for, which would be such a mess.
COLTON OGDEN: Worst library of all time.
VERONICA NUTTING: Worst
library of all time.
Yeah, that's a scary library.
So again, order can be really
powerful, being able to index
into a data structure.
COLTON OGDEN: Userman
says, "Fun fact, there
is an order dict in collections module."
Yes, that is correct.
And also, another fun
fact, as of Python 3.6--
is it 3.6.5?
I'm not sure.
Dictionaries are ordered just by
default, regular dictionaries.
So what I said was not entirely true.
The dictionaries typically are not
ordered because they're hashed.
So everything gets algorithmically
placed in an optimal way.
But Python, as of 3.6.something, by
default, your dictionaries are sorted.
So when you print your
dictionary, you'll
see everything in the order
at which you inserted it.
VERONICA NUTTING: Question.
So--
COLTON OGDEN: Not sorted, sorry.
Ordered based on when you
inserted the elements.
VERONICA NUTTING: Question.
Does that have anything
to do with alignment?
COLTON OGDEN: What do you mean?
VERONICA NUTTING: So I'm thinking--
now that I'm taking a
systems programming class,
a lot of what we think
about is how to make
what we're storing in memory
as efficient as possible.
And one of the really cool things
that we are always thinking about
is this idea of alignment.
So an int is--
how big is an int?
COLTON OGDEN: 4 bytes at the least.
32 bits.
VERONICA NUTTING: OK.
It depends on-- well, it depends
on your processor, I think.
COLTON OGDEN: It does
depend on your processor.
On modern machines, typically 4 bytes.
VERONICA NUTTING: But OK.
So let's say I had a
struct that was, maybe,
an int and then three
individual characters.
So a character is one byte
long, an int's four bytes long.
So if you asked me,
how big is that struct?
You might say 7 bytes.
But in fact, it's actually 8 byte
because we have a little bit of padding
that lets us align stuff.
And essentially, the reason
that alignment matters
is that it's easier for the computer
to deal with set chunks of data.
So for instance--
there's this fun tangent.
If we had a situation where we had a
char, a character, followed by an int
and then maybe followed by a
character, depending on whether or not
you're running your compiler with an
optimizer, the size of that struct
is going to be either 12 or 8 bytes.
Any idea about why that might be?
COLTON OGDEN: For the a struct
that's 7 bytes of actual data?
VERONICA NUTTING: Yeah.
So let me-- I'll try to just
draw what we're talking about
so we don't remember.
So again, this is
currently in a Python file.
This is a bit of a tangent, but
this would be in C++, for instance.
So let's say I have a struct--
just pseudo coding here-- struct
of one int, which is 4 bytes.
And then I wanted to also store
two chars, which are 1 byte each.
If I ordered my struct-- and
we'll loop back in a second
to the ordering of a dictionary.
But if I ordered this struct in this
way, a struct where it was my char,
then an int, then a char, in
theory, this would be 12 bytes.
Because essentially,
our compiler is going
to try to chunk it out
in chunks of 4 bytes
to make accessing that data faster.
But this is a bit of a tangent.
The reason I brought this up is that
you mentioned that dictionaries are now
ordered by default.
COLTON OGDEN: Yes.
VERONICA NUTTING: So I was just
thinking if that's a user side choice
or if it's an efficiency side choice.
COLTON OGDEN: That's a good question.
There was a talk that
Raymond Hettinger, who
is one of the lead Python
engineers, he gave about it.
I don't recall if he made
mention of whether it
was for optimization purposes.
VERONICA NUTTING: Yeah.
Because I think that would be--
it depends on how your
compiler's interpreting it.
But I think-- my sense is
that that would be actually
like less memory efficient.
COLTON OGDEN: Yeah, I think it would.
VERONICA NUTTING: Because you would
want to group elements in a dictionary
together in a way to
minimize memory space.
COLTON OGDEN: Not sure.
VERONICA NUTTING: Total tangent, yeah.
COLTON OGDEN: Not 100% sure.
VERONICA NUTTING: But
alignment is interesting.
COLTON OGDEN: The alignment makes
sense because the CPU is most
efficient at loading its word size.
So I guess in a--
I guess 64-bit machines
have a word size of 64.
So it's not entirely--
I have to see why we typically
still use 32-bit ints in that case.
VERONICA NUTTING: Interesting, yeah.
COLTON OGDEN: But, yeah.
It's more efficient for the computer
to load a character as a 32-bit--
as a word rather than as a--
I guess-- would it be a nibble?
I don't know what it would be.
It would be a small chunk of that.
Because then it has to take that
information out of the 32 bits
that it normally would have.
VERONICA NUTTING: A
metaphor I like to use
for this is let's say I
give you a box and I'm like,
hey, can you go into my room
and grab this list of things?
If you put-- it would be weird for
you to, if I gave you a giant box,
go and put a pencil in that box, right?
That seems like a lot of extra room.
Right?
So generally, your computer wants
to be as efficient as possible.
So if I go and ask
for just a pencil, I'd
give you a really, really small box.
But if I start asking
for more things, there's
a way to pick the right
size box so that you
would be able to bring everything back.
This is getting a little bit weird, but
one last thing-- last thing on this.
So let's say you had a cart
where you're putting boxes.
It would be a little bit
weird if you had a cart
with 12 different sized boxes, right?
The cart would-- you'd
have one giant box
on one end of the cart, and then a weird
teetering pile of smaller boxes, right?
If instead you had all
the boxes of the same size
and they were of a size big
enough to fit the largest element,
then your cart would be a lot more
stable and loading and unloading it
would be a lot easier.
COLTON OGDEN: Yeah.
VERONICA NUTTING: So
again, big picture thing
there was just the idea of alignment,
which is a little bit more low level.
We don't really have to think
about things like this with Python.
This would be something
you'd be looking out
more if you did systems programming.
Yeah.
COLTON OGDEN: Yeah, no, it's super cool.
It's super cool diving into
CPU levels and stuff like that.
VERONICA NUTTING: And again, it's
interesting about order of dictionaries
because that would affect alignment.
Interesting.
OK.
Cool.
Moving on.
I think we may have
missed a couple comments.
COLTON OGDEN: Yeah, we
missed a few a little bit.
Let's keep up with the
chat here little bit.
"Rename stream The Tangents
with Veronica," says JP Guy.
Yeah, no, that's where the fun lies.
"Do you have any beginner Python
projects you can recommend?"
VERONICA NUTTING: Oh, beginner proj--
OK.
Yes.
Yes, I do.
OK.
So here are my tips.
So Python is so, so,
so cool because it lets
you do all these things really easily.
I started programming in C
and there's just so much more
that you have to do with C in terms
of syntax and research versus Python.
Once you've realized that you can
abstract away and just go crazy and do
a bunch of things, you
realize it's super easy
to write short programs that
can be really, really useful.
So for instance, I have
an example of this.
Recently, I was trying to buy
a friendship bracelet with one
of my friends, and we
were debating what message
to get engraved on the
friendship bracelet
and there was a weird
limit of characters.
And I went online and I was like,
character counter, or something.
I would write different
messages and then
put them in the character counter,
click Count My Characters,
and then it would output
the number of characters.
And then I was like,
oh, this is so annoying.
There's got to be a
cooler way to do this.
And, duh, there is with Python.
So, for instance, let's say--
I'm just going to create a
string called engrave me.
And I'm going to say, hey, I'm-- oh,
this is cute-- happy we're friends,
and this will be on a friendship--
COLTON OGDEN: That's a
long friendship bracelet.
VERONICA NUTTING: It is.
OK.
And then a cool thing I can
do is I can just directly--
engrave me, and it'll--
[LAUGHING]
COLTON OGDEN: Can you please continue?
VERONICA NUTTING: And it'll tell me
the length of the number of characters
in the string.
OK.
So the length function, len, the length
function is actually super, super cool.
So if you give it a string--
[LAUGHING]
COLTON OGDEN: This is
supposed to be kid friendly.
VERONICA NUTTING: If
you give it a string--
OK.
So if you give it a
string, the length function
will return the number of
characters in the string.
But if we give it something
else, like a list,
it will give us back the
number of elements in the list.
COLTON OGDEN: Tying us back to lists.
VERONICA NUTTING:
Tying us back to lists.
So again, with that list we had before,
purple, orange, periwinkle, mustard.
COLTON OGDEN: It was just
an anonymous list, I think.
I don't think you assigned, did you?
VERONICA NUTTING: Yeah, x.
COLTON OGDEN: OK.
That's OK.
VERONICA NUTTING: This should work.
COLTON OGDEN: Oh, did you?
Did you assign it to x?
VERONICA NUTTING: Yeah, the list.
COLTON OGDEN: Oh, OK.
VERONICA NUTTING: So if you recall,
again, our list from before--
COLTON OGDEN: Oh, I see.
I was looking at this line.
I wasn't looking at that line.
VERONICA NUTTING: No, no.
So we had this really cool list of
Veronica's least favorite colors.
COLTON OGDEN: I thought they
were your most favorite colors.
VERONICA NUTTING: No, least favorite.
COLTON OGDEN: Oh, OK.
VERONICA NUTTING: Least favorite.
Oh, my gosh--
COLTON OGDEN: I was
going to say, I don't
think I've ever seen where
any of those colors--
VERONICA NUTTING: No, no, no.
My favorite colors are
silver, black, blue, pink.
COLTON OGDEN: To be fair, your
nails are periwinkle right now.
VERONICA NUTTING: Yes.
I would prefer to say that they are
the color of the Argentine flag.
Wow, this is really far.
No one can really see
this, but whatever.
COLTON OGDEN: I'm actually not sure
what the Argentinean flag looks like.
That's my bad, I apologize.
Oh, it is.
Yeah, you're right.
Yeah.
VERONICA NUTTING: We had
an important game recently.
COLTON OGDEN: It's being
really slow for some reason.
VERONICA NUTTING: [NON-ENGLISH SPEECH]
I don't know if anyone's
a soccer fan, but--
COLTON OGDEN: It's close.
It's very close.
VERONICA NUTTING: Oh, my gosh.
It's super close.
It's as close as you can
get with nail polish.
Yeah, no.
So I was just trying to be spirited.
OK.
But again, back to this.
So cool thing about Python is that the
length function is super versatile.
So again, we just saw a situation where
I gave it a string and length outputed
the number of characters in the string.
And then there's another
situation where we gave it a list
and it printed out the number
of elements in the list.
COLTON OGDEN: Yeah.
And this has a name.
This is called a Python universal--
VERONICA NUTTING: Python universal--
COLTON OGDEN: Universal-- what is it?
Python universal functions?
There's a specific name for it.
Crap, crap, crap.
I need to figure this out.
Python length function.
There's basically a set of functions.
So length is one of
them-- len is one of them.
But there are a bunch of
other ones that you can--
you implement in the
class of that object
a function with double underscores.
In this case, it would be length.
And you define the behavior
of that function when
you call len on that data structure.
VERONICA NUTTING: Yep.
COLTON OGDEN: So if I had an object
called Veronica and I wanted to say,
I guess, the length of what
Veronica-- that's a bad example.
If I had a--
maybe I have a shirt class, for example.
VERONICA NUTTING: Sure.
COLTON OGDEN: And when I call the
len function on that shirt object,
it gives me the length from top to
bottom in centimeters of that shirt.
But it wouldn't know otherwise
if I didn't say that.
Length-- it would probably give
me the size in bytes or something.
VERONICA NUTTING: Yeah, of the struct.
COLTON OGDEN: But you
basically override what
the len function does on your class.
VERONICA NUTTING: Wow.
COLTON OGDEN: And there's a
specific name for what that is.
Because there's a set of functions.
VERONICA NUTTING: OK.
And you're thinking Python
universal-- oh, built in--
COLTON OGDEN: I forget.
You use it with meta table-- or
not meta table-- is it meta tales?
The meta class of that object.
So defining these hidden functions
that give objects behavior.
And all of the core data
structures in Python,
from dictionaries to sets to lists,
all implement these functions.
VERONICA NUTTING: That's exciting, yeah.
COLTON OGDEN: It's a
good paradigm to follow
if you're implementing your own classes
and you want this Pythonic behavior.
VERONICA NUTTING: Absolutely.
COLTON OGDEN: Yeah, it's
absolutely essential
to take that into consideration.
VERONICA NUTTING: For sure, yeah.
So again, back to the main
question that someone asked.
I forgot who you are, but
thank you for asking this.
How do I get into basic Python?
This is a really great
situation where you're
going to have all these tiny things
in your life that you're just like,
the way I'm doing it could be better.
OK?
So I divide my personal CS
projects into two categories.
So I have the very small
projects where it's
like, this is something I need
right now that I am currently
doing in a way that's annoying or long.
Again, like having to go to a website
that counts the number of characters,
that was crazy.
So it's much better to just be like,
OK, I can, using the tools I have,
write a short, simple program
that will do this for me.
So that's one side of CS projects.
And then I have my other,
more complicated ones
that I'm always trying to--
I'm like, oh, my
Spotify could be better.
Let me go read on Spotify's API and try
to figure out a way I could modify it.
COLTON OGDEN: Hack into it.
VERONICA NUTTING: Well,
not even hack into it,
but maybe build a web app
or something that could--
another tangent.
I organize my-- this is
going to be interesting
because I'm curious what you're
going to think about this.
I like to organize my
songs by beats per minute
because I find that makes the
transition between songs much smoother.
COLTON OGDEN: You sound like a true DJ--
a budding DJ-- a programmatic DJ.
VERONICA NUTTING: Programmatic DJ.
So yeah, I have a
folder that goes through
in, like, five beat per minute chunks.
And then I listen to
all those playlists.
But I, at some point,
probably over break,
want to just write some
program that will organize it
for me because it's a pain.
COLTON OGDEN: Yeah.
VERONICA NUTTING: Yeah.
Do you ever do any small projects
just to improve your own life?
COLTON OGDEN: All the time.
But I typically-- well, I don't
about improve my own life.
If I ever find something
I need to automate,
definitely Python's my
go-to language for that.
Most of my hobbyist programming
is in games, I think.
So I don't do a lot of life improvement.
VERONICA NUTTING: You just do
games that you think would be cool.
COLTON OGDEN: Yeah.
VERONICA NUTTING: Interesting.
COLTON OGDEN: Mostly learning new
stuff and dabbling with stuff, yeah.
But not a lot of life automation stuff.
If I do need to do some
calculation or something
and it would be a pain
to use a calculator
or I need to analyze a good amount
of data, I'll use Python for it.
And it varies on a case by case basis.
VERONICA NUTTING: Interesting.
COLTON OGDEN: Somebody-- Adam Fighter
laughed at your joke, the Halloween--
because time complexity is spooky.
He says, "That was corny."
I think we--
VERONICA NUTTING:
Corny is a strong word.
COLTON OGDEN: It was candy corny.
Oh.
"That's a bad library," Cesar Man 2.
Oh, Rahul, big O of n--
wait, no, somebody else said it.
It was bhavik_knight.
"To clarify, search in
Python lists are O of n."
Yes, the search is.
I was referring to the indexing.
I might have misspoke.
Indexing would be O of 1.
But the O of n would be-- actually,
is it O of 1 indexing in Python?
I think it is.
VERONICA NUTTING: I think so, yeah.
That's where the order comes in.
COLTON OGDEN: "Do you guys have
any beginner Python projects?"
Yeah, we looked at that.
"Console calculator and a basic
turn-based fighter," says userman.
VERONICA NUTTING: What's
basic turn-based fighter?
COLTON OGDEN: Those are two
very different-- so when
I think of turn-based fighter,
I guess like a Final Fantasy,
like an RPG type system.
VERONICA NUTTING: RPG--
COLTON OGDEN: Like a fantasy game--
VERONICA NUTTING: Rotations per--
COLTON OGDEN: Role playing game.
VERONICA NUTTING: Role playing game.
Oh.
Oh, like One Night?
COLTON OGDEN: Kind of.
That's more like a
story-based role playing game.
But in this case, it
would be like you have
a group of people that have the ability
to attack another group of people,
I guess.
Like a party of fighters
versus monsters or whatever.
VERONICA NUTTING: Like Mafia?
COLTON OGDEN: No, that's more
like a deliberation game.
VERONICA NUTTING: OK.
COLTON OGDEN: So this would be like you
can either attack, use a magic spell,
or use an item.
VERONICA NUTTING: Oh,
Dungeons and Dragons.
COLTON OGDEN: Yeah,
Dungeons and Dragons.
That's the beginning of what RPGs are.
But that's what he's referring
to, a basic turn-based fighter.
But then console
calculator, I would say,
is probably much easier than a
turn-based fighter to implement.
That might be a good initial
project to start off with.
VERONICA NUTTING: That's cool.
COLTON OGDEN: "Typically, a serious C++
compiler will make a struct with an int
char and another int larger than
if you put the two ints first
because of alignments," says Andre.
VERONICA NUTTING: Yes.
I think so, yeah.
"--make a struct with an int
char and another int larger."
Yeah.
COLTON OGDEN: GX2G, "What's up, guys?
Heck yeah, Python."
What's up, GX2G?
Good to have you.
"She knows what she's talking
about," says Adam Fighter.
"Sexy [INAUDIBLE]," says Nicholai.
VERONICA NUTTING: Maybe we
should just read everything.
COLTON OGDEN: I shouldn't--
I mean, that wasn't a bad comment.
That was somewhat PG,
but it's debatable.
"Python's built on C."
Yep, Adam Fighter, Python is built on
C. So C, the libraries are compiled,
and then we can reference
those libraries after the fact.
""[INAUDIBLE] may be efficient, but
the modern computers of 32 and 64-bit
registers [INAUDIBLE]
processors," says Andre.
VERONICA NUTTING: "--32-bit--"
that sounds right, yeah.
COLTON OGDEN: "Where is our
professor, The Dark Lord?" says GX2G.
VERONICA NUTTING: Do people
call Malan The Dark Lord?
COLTON OGDEN: They've
called him The Master Jedi.
I guess it's The Dark Lord.
VERONICA NUTTING: Why now?
COLTON OGDEN: I don't know.
It's a little bit ominous, I think.
VERONICA NUTTING: Yeah, The Dark Lord.
I mean, he has not dark hair.
COLTON OGDEN: I think it's evolving.
It's becoming, like, Master Jedi.
Now he's turned to the dark
side and now he's The Dark Lord.
VERONICA NUTTING: Wow.
COLTON OGDEN: It's this evolution.
VERONICA NUTTING: So that would be--
what's his name?
COLTON OGDEN: Like, Anakin Skywalker?
VERONICA NUTTING: No, no, no.
COLTON OGDEN: Darth Vader?
VERONICA NUTTING: Darth Vader.
COLTON OGDEN: Yeah.
VERONICA NUTTING: I was
going to say Voldemort.
COLTON OGDEN: Voldemort.
Hey, same idea.
Same idea.
"Some programs and software
still need 32-bit out of 64."
Yeah, some applications
are still 32-bit.
VERONICA NUTTING: Yeah.
COLTON OGDEN: President of Mars, "How
is a dictionary automatically indexed?
What's the syntax?"
Why don't we talk about
dictionaries, actually.
VERONICA NUTTING: Sure, yeah.
COLTON OGDEN: Because
we talked about lists,
and I guess dictionaries
are a natural next step.
VERONICA NUTTING: Oh, one last
thing I want to say about lists.
So this is super cool.
This is also not very intuitive and this
is not something that we can do in C.
So in Python, we can have a list
of elements of different types.
COLTON OGDEN: Oh, true.
VERONICA NUTTING: Which is
super important to remember.
And I always think it's cool to remember
that lists are really, really flexible
and there's so much
you can do with them.
OK.
Awesome.
I will do--
I don't know.
It's hard to get inspiration.
There's not that much going
on in the rest of the room.
So I'm trying to--
OK.
Football.
COLTON OGDEN: A lot of shirts.
Oh, yeah.
VERONICA NUTTING: Football--
just trying to think of--
COLTON OGDEN: Searching for words.
VERONICA NUTTING: 7, which
is my favorite number.
And then let's do--
COLTON OGDEN: Lucky number 7?
VERONICA NUTTING: Is that a thing?
Oh, gambling.
COLTON OGDEN: Yeah, lucky number 7.
VERONICA NUTTING: I don't gamble.
COLTON OGDEN: And then pi.
VERONICA NUTTING: I don't know--
do you know the--
COLTON OGDEN: I don't
know the extra digits.
VERONICA NUTTING: That is lame.
OK.
Wow.
COLTON OGDEN: It is, yeah.
VERONICA NUTTING: That's
a cool thing to memorize.
COLTON OGDEN: There we go.
Close enough.
VERONICA NUTTING: Yo.
COLTON OGDEN: Beautiful.
VERONICA NUTTING: You'll see indeed
that they've maintained not only
their types, but also their orders.
Nothing crazy here.
Cool.
Now it's like what?
Dictionaries.
So when do you want to use dictionaries?
Well, let's think about dictionaries
as a way to group related data.
OK?
So not exactly like a row
in a data table necessarily,
but let's say I had a dictionary--
actually, let's even take one step
back and talk very, very basic.
What are the building
blocks of a dictionary?
So a dictionary is going to have
what are called key value pairs.
OK?
So I can build a very basic dictionary.
Do you have a--
give me a word.
COLTON OGDEN: We do could CS--
people in CS50, maybe.
VERONICA NUTTING: Oh, that's a good one.
OK.
Cool.
Let's do it.
So let's go ahead and do--
what do I call this?
OK.
I'll do staff.
And I'm actually going to do, I
think, a list of dictionaries just
to make it easier.
COLTON OGDEN: Oh, I see.
OK.
VERONICA NUTTING: I'll say name.
COLTON OGDEN: Oh, yeah.
That makes sense.
VERONICA NUTTING: Erin.
And then I'll say age.
COLTON OGDEN: I think she's 24, 25.
I don't remember.
VERONICA NUTTING: OK.
Cool.
And I'll say--
COLTON OGDEN: Oh.
VERONICA NUTTING: No, no.
Yeah, so again, what
we're doing here is we
are going to create a
list of dictionaries
where we have two key value pairs,
where the first pair is name,
and then, again, name being the key,
and then whatever that person's name is
being the value.
And then, again, age and 24--
oh, wow.
I misread userman's comment.
I'm going to keep going.
OK.
Cool.
Colton, how old are you?
COLTON OGDEN: I am 27.
Also, I forgot to read off--
Buzz Buddy 77 has followed
and Bee Shack has followed.
So thank you very much for following.
VERONICA NUTTING: You said 27?
COLTON OGDEN: Yeah, 27.
VERONICA NUTTING: Awesome.
COLTON OGDEN: Bee Shack--
I gotta get this down a little bit.
VERONICA NUTTING: Get what down?
COLTON OGDEN: This slider so I can
read the other people that joined.
Tech Entertainer has followed.
Thank you, Tech Entertainer.
And then Adam Fighter 10101,
Newbie Boy, and [INAUDIBLE],,
which you read earlier.
So thank you everybody who's followed.
VERONICA NUTTING: OK.
Oh, my gosh.
17.
COLTON OGDEN: 17.
VERONICA NUTTING: I am not 17.
I'm almost 20.
My birthday's on Friday.
COLTON OGDEN: Are you excited?
Oh, it's on Friday.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Whoa.
Well, happy early birthday.
VERONICA NUTTING: Isn't that exciting?
COLTON OGDEN: It is exciting.
20?
That's like-- you're out
of your teens finally.
I remember when I turned 20, I
was like, damn, a new chapter.
I'm close to 30.
I'm 27.
I've got--
VERONICA NUTTING: Do
you feel close to 30?
COLTON OGDEN: I don't feel close to 30.
VERONICA NUTTING: I think
you don't look close to 30.
COLTON OGDEN: People typically
think that I'm 22, 23.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Which is--
I'll take it.
VERONICA NUTTING: If anyone
wants to share what they thought
Colton's age was, I'd be curious.
Or what my age was.
I always ask people that.
I'm like, oh--
COLTON OGDEN: Yeah, I
would say 19 or 20, yeah.
VERONICA NUTTING: OK.
Wow, Colton--
COLTON OGDEN: What do people
guess for you typically?
I would not guess 17.
VERONICA NUTTING: So-- OK.
So one time I was in an
airport and they didn't
want to let me go through
the full body scanner
because they thought I was 16 or under.
There's some cut off in Argentina.
COLTON OGDEN: This was recently?
VERONICA NUTTING: Yeah, like last year.
And they were like, oh, no,
you can't go through there.
And I was like, why?
And they're like, because
you have to be 18.
And I was like, oh, I'm 18,
because at the time I was 18.
And then I also pass as older.
COLTON OGDEN: So it's varies.
Interesting.
OK.
VERONICA NUTTING: I think most people
would say anywhere from 18 to 24.
COLTON OGDEN: I feel like
there's not a lot of change that
happens during that time frame,
too, for a lot of people.
I feel like you reach your maturation,
your growth at 17, 18 typically,
for a lot of people.
And then for me, it was 21, 22 is
when that happened for me, I think.
Actually, no.
I think 20--
I don't know.
I made changes throughout
my early adulthood.
But I think for a lot of people,
it stabilizes at a certain point
and then there's not a lot of change
between that range of ages, right?
VERONICA NUTTING: Interesting.
Yeah.
COLTON OGDEN: That's
an observation I made.
I could be wrong.
I think it changes for everybody.
It's variable for people.
VERONICA NUTTING: Yeah, no.
That's exciting.
OK.
What are these?
COLTON OGDEN: "Moving Bitcoins.
That would be the fastest way to
achieve maximum stress level."
VERONICA NUTTING: What do you mean?
Oh, just--
COLTON OGDEN: I've never done that.
But I think Nick is going to show us--
VERONICA NUTTING: I was going to say,
have you had a Bitcoin person come on?
COLTON OGDEN: No.
Nick wants to do a
stream on Bitcoin mining.
VERONICA NUTTING: Oh, my goodness.
COLTON OGDEN: Which I
think would be super cool.
Because I actually don't
know anything about it.
VERONICA NUTTING: I know
nothing about it either.
That's definitely-- hey.
We have a surprise guest.
COLTON OGDEN: Oh, yeah.
A surprise guest again.
VERONICA NUTTING: Dark Lord.
COLTON OGDEN: You were referred
to as The Dark Lord today.
DAVID MALAN: Oh, really?
I just heard you were
talking about ages,
and I was thinking overflow jokes.
[LAUGHING]
COLTON OGDEN: Because someone
called you The Master Jedi.
I forget who called you The Master Jedi.
Now you're The Dark Lord.
So you're the trajectory of
Darth Vader, at this point.
DAVID MALAN: Oh, that's great.
Thanks.
Hi, everyone.
COLTON OGDEN: He has a redemption
phase at the end of the bell curve.
DAVID MALAN: Oh, OK.
Well, anyhow, I don't want to interrupt.
Just wanted to say hello to everyone.
But we'll see you all online
in the chat room next.
COLTON OGDEN: Cool.
VERONICA NUTTING: Oh, that's exciting.
COLTON OGDEN: Are you
going to pop into the chat?
DAVID MALAN: Yeah, I have it open now.
I've been lurking.
So now I'll--
VERONICA NUTTING: Oh, that's exciting.
Yay.
Good.
DAVID MALAN: Bye.
COLTON OGDEN: See ya!
VERONICA NUTTING: Bye!
Surprise guest.
COLTON OGDEN: Always a pleasure
having a surprise guest.
"Thanks for getting Keith,
if that's what you mean."
"Have to define his usual--" OK.
They're having a side
conversation there.
President of Mars specified-- so before
we started getting into dictionary,
he specified that.
Oh, "Made a script that downloads
a DLL zip file," says userman2.
"Unzip somebody allows them
to delete the zip file.
I love Python for utility stuff."
VERONICA NUTTING: Oh, that's cool.
COLTON OGDEN: Yeah, it's excellent.
It's almost like a make clean process.
VERONICA NUTTING: Wow.
COLTON OGDEN: Yeah, can be super
tedious to do all that stuff by hand.
Yeah, that's a perfect example.
"Dict one is just called spam."
VERONICA NUTTING: Yeah.
COLTON OGDEN: It would be dict spam.
Spam is the key phrase
of the value, yeah.
Sure, thanks.
"Sterling," says Nikolai "from C++."
VERONICA NUTTING: Yes.
COLTON OGDEN: Sterling is--
that's not as-- I guess it's
almost like len in Python.
VERONICA NUTTING: Yeah,
it is kind of len.
COLTON OGDEN: It's not terrible.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Save
People, "For the kids,
you would need to convert the
dict items to a list to do--"
VERONICA NUTTING: I think they're
still referring to the previous one.
COLTON OGDEN: Oh, yeah-- says
userman2 for the one or zero.
VERONICA NUTTING: Nice to see people
collaborating, helping each other.
COLTON OGDEN: Yeah, we
got side conversations.
Gulyash74, thanks for
being a part of the chat.
"Sterling usually uses C++."
Yes, Rahul, that's correct.
"Now I get what automatic
refers to--" yeah.
VERONICA NUTTING:
Automatic referring to--
COLTON OGDEN: I think to automation--
doing things automatically, yeah,
I'm guessing.
"In C, memory is like a block
of uncut American cheese.
With respects to data
structures, an array
is American cheese
sliced in equal widths."
VERONICA NUTTING: Interesting.
COLTON OGDEN: "A struct
is like an American cheese
block sliced in unequal widths.
So memory relates to data structures."
But structs are technically chopped in
the size that they can maximally hold,
isn't that correct?
VERONICA NUTTING: It
depends on the compiler.
COLTON OGDEN: Right.
OK.
So some compilers will
optimize it so that if it
knows in advance that a struct is only
going to contain a subset of the bits
that it contain, it will
cut it-- it'll truncate it.
VERONICA NUTTING: Yeah.
COLTON OGDEN: OK.
That's cool.
It's good to know.
Nikolai, "This be some heavy CS stuff."
Yep, yep.
VERONICA NUTTING: Actually, on that
one tiny, funny note about optimizers.
So there's this-- are you ever
going to do an assembly language?
COLTON OGDEN: I've thought about it.
I would have to spend a lot--
if I was going to do it,
I would spent a lot of time reading up
on it and getting comfortable with it.
But if somebody who knows
assembly wanted to do it,
I could probably conversationally--
VERONICA NUTTING: I know some.
COLTON OGDEN: Yeah?
OK.
We could maybe do an assembly
stream, if you want to do that.
VERONICA NUTTING: No, but
assembly's pretty cool.
So essentially when you compile
a C file, you can do it in a way
that you produce the assembly file.
And then you can go in
and it's usually dot ASM,
and you can essentially see
what the actual instructions are
being passed in, right?
So when we look at code that's C
code or Python, it's made in a way
that a person can read
it and understand.
But there's a lot of
things that fall away
when we are compiling, when we're
going down all the way to binary.
And it's really interesting if
you look at an assembly file
to be like, wow, what
has my compiler realized
was not really important in
this translation process?
And there's all this really cool stuff.
So, for instance, if you
write a for loop that's like--
OK, so let's say--
let's pretend I had a variable
that I initialized to 0.
So an int that I initialized to 0.
And then I had a for loop that we
went through the for loop 100 times,
increasing it by one every time,
and then printing that result.
So in the assembly
instructions, if you've
compiled your program with an optimizer,
your computer would be like, oh, wow,
we don't need this for loop.
I can see that you're
just really changing
an int from a starting value
of 0 to a starting value of--
I forget what I said before--
COLTON OGDEN: 100.
VERONICA NUTTING: 100, yeah.
And it'll just directly say, print 100.
COLTON OGDEN: Oh, yeah.
VERONICA NUTTING: Which is so funny.
COLTON OGDEN: It'll turn
the variables into literals.
VERONICA NUTTING: Exactly.
Yeah, exactly.
So it'll squish steps together
that don't have to be there.
So there's all this cool work that you
can write a really efficient program,
but then a really good optimizer is
still going to cut a bunch of it out.
It's really funny.
COLTON OGDEN: Makes sense, yeah.
VERONICA NUTTING: Yeah,
it's super interesting.
COLTON OGDEN: Yeah, I
feel like I've seen that.
I was watching some CPP
Con videos recently,
which is a big event where they
have a lot of pretty hardcore stuff.
It's pretty cool.
There's a lot of these cons--
VERONICA NUTTING: Like
Comic Con type thing?
COLTON OGDEN: Yeah,
but they do it for C++.
It's pretty cool.
This guy did a deep dive into
debugging his C++ program,
then go into the assembly.
VERONICA NUTTING: With, like, GDB?
COLTON OGDEN: Yeah, with GDB.
Exactly.
Yeah, it was pretty cool.
VERONICA NUTTING: That's cool.
Debugging-- so, again, there's all
these different steps of translation.
And it's really interesting
because it can actually
be way harder than you think to go from
assembly and work your way backwards.
We had a lot of this in this
class where we're given assembly,
like an assembly file, and we're
asked what C code might produce this.
And there's usually a bunch of different
answers because it's not deterministic.
I could write a ton
of different programs
that might produce the same
assembly file, which is interesting.
But that's systems programming.
COLTON OGDEN: Yeah, yeah.
It makes sense.
You're going down to a smaller
subset of possible commands, too.
So there's only a certain smaller number
of ways you can do something, right?
VERONICA NUTTING: Yeah.
COLTON OGDEN: "Veronica wearing
least favorite color nails."
"Classes can also have
custom length values
by adding def link self to the class."
Yes.
VERONICA NUTTING: That's
what you were talking about.
COLTON OGDEN: Yeah, exactly what
we were talking about before.
The meta-- what is called?
The meta class of that object?
I think it's the meta class, where
you can define-- there's a term for it
and I don't know what
the term is for it.
I read it in a book with this Python
interface for all these functions.
But yes, exactly.
Exactly what we were talking about.
"[INAUDIBLE]," says Adam Fighter.
Userman, "I know it's an example, but
having a shirt as a height property
would be better there, since length
would be ambiguous as to what it was."
Correct.
Yeah, exactly.
I was just reaching for--
I looked to my left and there's
shirts hanging on the wall
here, just looking for a desperate
analogy to fit that example.
"Hello, world," says APS Night.
JP Guy's got a new-- the PogChamp.
VERONICA NUTTING: What's PogChamp?
COLTON OGDEN: It's this
guy named Gootecks,
who's a famous fighting game person.
And in a video he made this face
and it's become a meme on Twitch.
VERONICA NUTTING: Wow.
COLTON OGDEN: There's a lot of
these memes and a lot of these--
VERONICA NUTTING: I'm going
to have to explore them.
COLTON OGDEN: Yeah, there's a lot.
I don't know a lot of them, like
forehead and lol and PogChamp.
They all have an origin somewhere.
Kappa is a really famous
one, like a sarcastic face.
VERONICA NUTTING: Can
you make custom ones?
COLTON OGDEN: Yeah, you can.
VERONICA NUTTING: Do you have one?
COLTON OGDEN: So when we become an
affiliate, we get to put custom ones.
I want to have David tearing
a phone book as an emoji.
VERONICA NUTTING: What
would the label be?
COLTON OGDEN: I don't know.
I'd have to think about that.
Anybody have an idea?
If anybody has ideas for
that in the chat, toss them.
VERONICA NUTTING:
Please share that, yeah.
COLTON OGDEN: But that
would be an amazing one.
"I do life improvement
in Python projects.
Not to take away anything, but can't
you just use words for length?"
says [INAUDIBLE].
By the way, thank you for joining us.
"Not to take away anything, but
can't you just use words for length?"
I'm not entirely sure what you
mean, if you can clarify that.
"Could you please tell briefly what
short projects you did recently?"
says APS Night.
Oh, you did go into that a little bit.
VERONICA NUTTING: Yeah,
talked about that.
COLTON OGDEN: What did I do recently?
I wrote a script to automate the
PDF generation for CS50's quiz.
VERONICA NUTTING: Nice.
COLTON OGDEN: So that would
be something that I did.
But that's for work, it's
not a personal project.
And that's somewhat of a large project.
But that's an example.
We have a platform online called Grade
Scope that we submit our quizzes to,
and you can automate how you
grade them that way a lot
better than you could if
you printed the quizzes out
and, by hand, which is
how we used to do it,
grade all the quizzes, which you
just have to carry a bunch of paper
across campus.
It was a nasty.
This was three years ago that
we were doing it like that.
VERONICA NUTTING: There's always
1,000 ways to do something.
COLTON OGDEN: Yeah.
VERONICA NUTTING: And there are
three or four that are the best ways.
COLTON OGDEN: Yeah.
If you're in Python, Python's slogan is
there's only one perfect way to do it.
VERONICA NUTTING: Really?
COLTON OGDEN: Yeah.
That's part of the Pythonic
mantra or whatever.
There's one best way to do it.
But basically taking in
all of the submissions
that people did online,
which were markdown files,
converting those to
PDF, taking those PDFs
and then putting them together in a
big PDF file, so thousands of pages,
and then uploading that to Grade Scope,
where that thing gets automatically
chopped up into the size of the quizzes.
That's how we do--
that's something that we use Python
for to automate our grading process.
VERONICA NUTTING: That's cool.
COLTON OGDEN: So you could use it for
almost literally anything you want.
VERONICA NUTTING: How long did
it take you to set that up?
COLTON OGDEN: The
original quiz was probably
a two-day thing with a lot of testing.
And I had to add to check50
integration this year.
That was troubling because
my environment on my Mac
was a little bit screwy with a check50.
VERONICA NUTTING: Interesting.
COLTON OGDEN: So I had--
shout it to Brian Yu.
He helped me out quite a bit with that.
VERONICA NUTTING: And check50,
for anyone that doesn't know,
is the tool we use to automate grading.
COLTON OGDEN: Yeah.
VERONICA NUTTING: To check
the correctness of code.
COLTON OGDEN: "I made a solver for
some puzzle game--" [INAUDIBLE],,
who's a regular, "--in Python once.
It's very easy to model the data
and modify it than most languages."
Yeah.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Because lists
and dictionaries and whatnot
are just so easy and flexible to use.
VERONICA NUTTING: They're so easy.
COLTON OGDEN: The syntax
tax is super clean.
"Rotations kappa," says JP Guy.
We were referring to earlier.
I forgot exactly what it is.
But that's the kappa--
VERONICA NUTTING: Oh, it's cool
that you have inside jokes now
with this community.
COLTON OGDEN: Yeah, yeah.
VERONICA NUTTING: Oh, that's so nice.
COLTON OGDEN: Inside jokes is a big
part of what makes it so much fun.
Oh, indexing-- oh, no, that wasn't it.
"Indexing is pretty much always O
of 1 since you provide an index."
VERONICA NUTTING: Yeah.
COLTON OGDEN: Yeah.
"I'm a beast at Mafia," Stay Peaceful.
"Great game."
I feel like we're so
far behind in the chat.
I feel like that was so long
ago that we talked about that.
VERONICA NUTTING: That
was so long ago, yeah.
COLTON OGDEN: "X Comm series--"
yep, X Comm series is great, Andre.
Are you familiar with X Comm?
It's a turn-based strategic
fighting game with aliens.
VERONICA NUTTING: Term?
COLTON OGDEN: Turn-based.
VERONICA NUTTING: Turn-based.
COLTON OGDEN: So you're
looking at it top down
and you have a bunch of fighters
that go around and shoot--
VERONICA NUTTING: Oh, and turn-based
as opposed to in real time.
COLTON OGDEN: Yeah, exactly.
VERONICA NUTTING: So you could
pause it, leave, come back
and be at a specific turn.
OK.
COLTON OGDEN: Yeah, exactly.
VERONICA NUTTING: Like chess.
COLTON OGDEN: Like chess.
Exactly, like chess.
JP Guy, "Do play Town of Salem?"
Have you heard of Town of Salem?
I have heard of it.
I haven't played it.
It's like Mafia, but--
VERONICA NUTTING: This
is our gamer person.
I feel like--
COLTON OGDEN: Yeah.
Do you play much games?
What do you do?
VERONICA NUTTING: Interesting.
Do I play-- I like Sudoku.
COLTON OGDEN: Sudoku?
OK.
VERONICA NUTTING: I don't
know if that's a game.
COLTON OGDEN: Yeah.
VERONICA NUTTING: That's a game?
COLTON OGDEN: Yeah.
VERONICA NUTTING: OK.
I like Sudoku.
And then besides that--
COLTON OGDEN: Sudoku is a--
it's a nice flexible game
because it's something
you can actually play on paper, too.
VERONICA NUTTING: And play by yourself.
COLTON OGDEN: Yeah, play by-- like
Solitaire, but more sophisticated.
VERONICA NUTTING: Yeah.
I like Risk.
COLTON OGDEN: Oh, yeah.
VERONICA NUTTING: To
play with other people.
COLTON OGDEN: I haven't played it
much, but I'm familiar with it.
It's like a game called
Civilization for PC.
VERONICA NUTTING: Yeah.
So it's basically like, you are--
it's cool because it's strategy,
you're trying to take over the world.
But people always care more
about what country they want
or what region they want more so than--
COLTON OGDEN: So they
prioritize a specific region?
VERONICA NUTTING: Yeah, I'm always
like, I want Argentina and Japan,
or something cool.
And then everything else,
it doesn't really matter.
I don't need to--
COLTON OGDEN: Oh, I see.
You start off at Japan and your
goal is to get to Argentina?
VERONICA NUTTING: Oh!
COLTON OGDEN: Is that
what you're saying?
VERONICA NUTTING: No, no.
That's not exactly what I'm saying.
Sorry.
What I'm saying is, the point
of Risk is world domination.
COLTON OGDEN: Right, yeah.
VERONICA NUTTING: But I have
found that, definitely in my case
and also when I'm playing
with other people,
that it ends up being more
so than world domination,
people are more interested
in just colonizing, getting
their hands on a specific
country or region
that they like for other reasons that
have nothing to do with the game.
Sorry.
That's another tangent.
COLTON OGDEN: Nationalism.
VERONICA NUTTING: Yeah.
So I like Risk.
What else to I play?
Chess.
Trying to learn Bridge.
My mom's a big fan of Bridge.
And then really don't--
I don't play anything on my phone.
COLTON OGDEN: There's
only so much time, right?
Busy Harvard students don't have
time to play video games anyway.
I feel like that's a common
theme that I've heard.
Except Nick Long does--
on his vacation, he was
telling me, he'll play games,
but only when he's on vacation.
VERONICA NUTTING: I learned to
play Smash Bros over the summer.
COLTON OGDEN: Oh, nice.
Which one?
Which one?
Do you remember?
There's five or six--
VERONICA NUTTING: A recent one.
COLTON OGDEN: OK.
The one for Wii U, was it?
Maybe?
VERONICA NUTTING: The one
that we have in the office.
COLTON OGDEN: I think
it's the one for Wii U.
VERONICA NUTTING: I don't think we were
playing it with the Wii controllers.
But maybe it's a different--
COLTON OGDEN: Yeah, you can play
with physical controllers, too.
VERONICA NUTTING: OK.
Yeah, that was pretty fun.
Really cool different backgrounds.
OK.
Let's see what else.
COLTON OGDEN: "Whenever
I play lying games,
I always have a hard time hiding
the fact that I am the bad guy,"
says userman2.
VERONICA NUTTING: People
always think I'm--
people will assume I'm the bad person.
COLTON OGDEN: Do you have an evil
look while you're playing the game,
possibly?
VERONICA NUTTING: That's interesting.
I don't know.
COLTON OGDEN: --just menacing.
VERONICA NUTTING: With One Night,
people always assume I'm the wolf.
COLTON OGDEN: You're just shady.
People just think you're shady.
VERONICA NUTTING: I think
it's all the black clothing.
COLTON OGDEN: "From math
import--" oh, yeah, we
could've done that, from math import.
That's another thing.
Why don't you just demonstrate
that since we haven't
done a Python thing for a few minutes.
From math-- yeah, exactly.
And now you can just, I
think, literally just type pi.
VERONICA NUTTING: Oh, just pi?
COLTON OGDEN: I think so, right?
Yeah.
And so now you're--
now it's easy.
VERONICA NUTTING: That is great.
OK.
COLTON OGDEN: Just pi, just like that.
VERONICA NUTTING: I think I was
way off when I-- oh, my god.
COLTON OGDEN: Oh, while on
dicts, it might be a good time
to show creating dictionaries
using the dict constructor, where
you can pass in arguments like that.
If you want to demonstrate that--
VERONICA NUTTING: Sure.
I think it's just--
COLTON OGDEN: Yeah, just dict like that.
And then I think you can specify the--
I forget whether you need--
oh, I think it takes multiple arguments
in the equals format, named arguments.
Right?
So try it.
So try to put name
equals Veronica, I guess.
In this case, it'd be a little bit--
dictionary, yeah.
Yeah, that's fine.
Age equals 10-- not 10.
I'm just thinking of random things.
VERONICA NUTTING: No, no.
Go for it.
COLTON OGDEN: And then favorite
color equals periwinkle.
But I think those need to be strings.
So Veronica needs to be a
string and so does favorite.
VERONICA NUTTING: But you think
the key value pair does not.
COLTON OGDEN: I think it--
VERONICA NUTTING: I
guess we'll find out.
COLTON OGDEN: Yeah because
you're using symbols here.
So name is a symbol, which
is referring to the argument.
You can use 10 as a literal because
it's going to use it as a number.
VERONICA NUTTING: A number, yeah.
COLTON OGDEN: And then
fave color doesn't
need to be-- oh, those need
to be-- no, those can just
be names because they're symbols, yeah.
And then periwinkle.
So I think this is how you use it.
I actually very seldom
ever use this syntax.
But it worked, yeah.
Great.
So thanks.
Shout out to userman2
for that suggestion.
You can do that.
You can also use what are called
dictionary comprehensions.
And we'll get into list
comprehensions a little bit later.
But that allows you to
programmatically assemble a dictionary
from a collection of values that you
can create a function to generate.
So yeah, good suggestion there.
"Code reviewers will kill
you if you have a list,
but the variable name is not a
plural word," says Conrad Ruder.
Thank you for joining us, by the way.
VERONICA NUTTING: What does that mean?
What do you mean?
COLTON OGDEN: If you have a list, but
the variable name is not a plural word.
VERONICA NUTTING: Oh.
COLTON OGDEN: So entries, data points.
VERONICA NUTTING: But staff is plural.
COLTON OGDEN: Yeah.
VERONICA NUTTING: Staff is plural.
COLTON OGDEN: Yeah.
Staff is technically a singular and--
staff-- it's a staff--
number of staff.
Yeah, it's a plural word.
Yeah because you would
have to say member of staff
if it were a single person, right?
Staff can be both.
"Happy early birthday," says userman2.
Wow, we are so far--
VERONICA NUTTING: So far behind.
COLTON OGDEN: I love
how much chat there is.
"Happy birthday in advance."
"Whoa, Colton, you're 27?
You look much younger."
Yeah, 27.
28 pretty soon.
In February, I'll be 28.
"Can we please increase the picture
quality a tiny bit next time?
I guess many people have
internet issues, including me,
so that'd be great."
Yeah, [INAUDIBLE],, it's
something that we'll
be able to do as soon as
we become an affiliate.
Unfortunately right now, we
are not an affiliate yet.
We are working on the
onboarding process.
VERONICA NUTTING: With Twitch?
COLTON OGDEN: Yes, correct.
And when we become an affiliate,
we should have the ability
to downscale our stream.
VERONICA NUTTING: Or give options.
COLTON OGDEN: Yeah.
We should have a 720 or 480 option.
But at the moment, unfortunately--
VERONICA NUTTING: Is this 1080?
COLTON OGDEN: Yeah, this is at 1080P.
VERONICA NUTTING: Oh, nice.
COLTON OGDEN: We don't have
that ability right now.
I'm sorry about that.
But it's something that
we're definitely working on.
You can visit this video on YouTube.
It'll be up later.
And some people might be watching
this on YouTube after the fact.
But yes, we'll be working on that ASAP.
VERONICA NUTTING: And YouTube
obviously gives you that option.
COLTON OGDEN: "There
was a time where someone
nailed being a tanner in One
Night Werewolf, though," userman2.
We got Werewolf players
in the chat today.
VERONICA NUTTING: Yeah.
COLTON OGDEN: This is awesome.
VERONICA NUTTING: I
didn't even know it was
a game that other people knew about.
COLTON OGDEN: Yeah,
it's gotten pretty big.
Apprentice tanner, that's the one.
The apprentice tanner.
Love that.
That dynamic is really cool.
VERONICA NUTTING: That is
an interesting dynamic.
COLTON OGDEN: Falling
Feather 1, "Hey, guys."
JP Guy, "DJ--" Oh, this is all
when David popped in the chat.
"Master Yoda."
Let's pause the chat reading here.
Let's jump into the next--
I'll come back to more of it.
But let's go to the next--
VERONICA NUTTING: Sure.
Let's just-- I'll create
another fake dictionary.
Unfortunately-- I'll just print staff
so we can see what we had done before.
OK, cool.
COLTON OGDEN: Oh, yeah.
You were working on this.
You were making a list of dictionaries.
VERONICA NUTTING: Yeah, so we
have a list of dictionaries.
And I think-- yeah,
that seems big enough.
OK, cool.
So now let's talk about
indexing into this dictionary.
So let's say-- a couple things to note.
Remember, list of dictionaries.
So the first index you're going
to want to be thinking about
is essentially, what dictionary
do you want to be dealing with?
So let's go ahead and let's do me--
let's go ahead and do print staff.
And I'll go ahead and do 2.
Remember, everything is zero indexed.
So now we're at the dictionary
that corresponds to me.
And let's say I wanted to
go ahead and print staff
and then I wanted to
see what my name is.
COLTON OGDEN: Right.
OK.
So indexing into that entry list.
VERONICA NUTTING: Yeah.
So again, staff index 2,
we're saying, hey, please go--
we're in a list.
Please go to the third
element in our list.
Remember, we're zero indexed so
we're starting to count at zero.
And then we're saying, hey, please give
me the value associated with the key
that is name.
COLTON OGDEN: So this is demonstrating
multiple layered indexing
into some data structure.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Like a composite data
structure where we have this list,
but now we've made it more complicated
by making it a list not of integers
or strings but of dictionaries.
VERONICA NUTTING: Exactly.
COLTON OGDEN: And now you
have this multilayered way
of actually getting to the specific
piece of data that you need.
VERONICA NUTTING: Yeah.
And again, I think this is great.
Anytime you have data
that's related to each other
that you want to keep
together and you want
to be able to access
systematically in a way that--
it's like-- what's a
good analogy for this?
It's like podded data.
a dictionary is--
COLTON OGDEN: Potted data?
VERONICA NUTTING: Well,
I was just thinking
if I throw a ton of data at you and
you want to group things together,
you can do that in pods.
COLTON OGDEN: Oh, pod.
VERONICA NUTTING: Pod.
COLTON OGDEN: I thought you
said potted, like a plant.
VERONICA NUTTING: No.
I said pod, like a pod of--
COLTON OGDEN: A pod, yeah.
VERONICA NUTTING: Pod.
Do you have a better metaphor--
COLTON OGDEN: No, that's great.
I misheard what you said.
No, that's perfect.
Yeah, just a nice little
collection of related information.
VERONICA NUTTING: Let's
really quickly, let's
just remember what we've
talked about so far.
So far we've looked at
lists and we've already
talked about that there's so much in
Python that you can do with lists.
They're great.
They are ordered.
So again, we can directly
index into a list.
And we can have--
a list can contain elements of
different types, which is great.
And now we looked at dictionaries, we
just looked at a list of dictionaries,
and we talked a little bit about
the relationship between keys
and their values, and
again, how to access
different things within a
dictionary, and again, in this case,
a list of dictionaries.
So now I was thinking we could
jump into another structure, which
is called sets.
COLTON OGDEN: Yeah, that would be great.
VERONICA NUTTING: Awesome.
So the way we create an
empty set is a bit weird.
I think we have to say--
I want to call it something else.
OK.
So before we jump into sets, let me
give you a bit of background on sets.
So essentially, sets, they have a
couple very important characteristics.
The first thing is that
they are unordered.
And one can argue there's no real
benefit to something being unordered,
but it's just something to keep in mind.
And then the next thing is that
there are no duplicates in a set.
Do we have some people
that just followed?
COLTON OGDEN: Yeah, aviato,
and Real Curious Kiwi,
who's Brenda Anderson, which is--
VERONICA NUTTING: Yeah!
COLTON OGDEN: She's
in our Facebook group.
VERONICA NUTTING: That's so exciting.
COLTON OGDEN: So thank you, aviato,
and thanks, Brenda, for following.
Appreciate it.
VERONICA NUTTING: And following means--
COLTON OGDEN: Following means that
they can contribute to the chat.
VERONICA NUTTING: Oh,
that's so exciting.
OK.
And this is also streaming on Facebook?
COLTON OGDEN: This is also
streaming on Facebook.
Unless I messed that up.
I don't think so.
I think it's streaming.
Yeah, it is.
It started officially at 1:00.
Sometimes you have to manually go in.
So if we stream in advance a little
bit of music, which we sometimes
do, and it's before the
official Facebook time,
we'll have to manually go in and say
trigger the event early, actually.
Because Facebook doesn't detect whether
you're streaming and then immediately
start the video.
It waits until the specific
time that you scheduled it,
regardless of whether you're
actively streaming to it,
and then it will upload it.
We actually pipe our streams
to two separate spots.
So right now we're streaming to
Twitch and Facebook simultaneously.
And so it receives the
bits, but won't actually
broadcast them until it hits that
cut off or we manually start it.
VERONICA NUTTING: Interesting.
I'm currently doing a lot
of work with pipes in my--
COLTON OGDEN: Pipes are really cool.
We covered a little bit of
that in our Linux class.
VERONICA NUTTING: OK.
That's cool, yeah, like
pipping data in and out.
COLTON OGDEN: Are you talking about
C piping, like using pipes in C?
VERONICA NUTTING: Like shell commands.
COLTON OGDEN: Oh, shell commands, yeah.
VERONICA NUTTING: Yeah.
COLTON OGDEN: But that's
what we were saying.
VERONICA NUTTING: That's
what you were saying?
OK.
So that's cool.
Cool, weird to say.
Cool.
So let's just create a set that
I'm going to call chairs equals--
it's better when there's--
COLTON OGDEN: Well, there
could be a set of names,
for example, of first and last names.
VERONICA NUTTING: Sure.
COLTON OGDEN: So let's
just do staff again.
Let's just make that a theme.
VERONICA NUTTING: Sure.
OK.
Names equals-- so a
couple of things to note.
So with a list, we have the
square brackets with a dictionary,
we have curly brackets
with key value pairs.
And then with a set, we have
curly brackets with just elements.
And we'll look at this in--
COLTON OGDEN: So it's almost like if
you were to mix a list and a dictionary
together.
VERONICA NUTTING: Yeah, kind of--
in some ways.
COLTON OGDEN: In the syntax.
Not in a semantic purpose of--
VERONICA NUTTING: Visually, for sure.
So let's go ahead and come
up with names of staff.
Greg, Brian.
And now this is where something
interesting is going to happen.
OK?
Well, first, let's see what
we get when we do this.
OK?
Go ahead and print names.
OK.
So a couple of things
that have happened.
What's happened?
What's changed?
Do you notice anything interesting?
COLTON OGDEN: Well, you
created a set of first names.
VERONICA NUTTING: Yeah.
COLTON OGDEN: So this is going to be--
I will project that we
might run into an issue
if we tried to add
multiple first-- do we
have staff that have the
same first name, by chance,
of any of those people?
I don't think so.
We only have one Greg, one Brian.
Yeah.
I was going to say if you
have entries that were people
that we have two of the
same first name, that's
when we start to run into issues.
But here, I can just see that--
VERONICA NUTTING: What happened
between this line and this line?
COLTON OGDEN: Oh, the order changed.
VERONICA NUTTING: The order changed.
COLTON OGDEN: Yes.
VERONICA NUTTING: And again,
remember, sets our unordered.
So our computer is not storing
information necessarily
about the order of sets,
which is interesting.
You really have to remember-- which
is why we can't index into a set.
Because again, we don't
have order attached to it.
OK.
So I'm going to create a different set.
Because you're right, the
name example doesn't quite
work with what I want to show.
So instead, I'm going to say--
OK.
This is a bad example, but
I'll say sizes equals--
and this is-- maybe I'm going
to create a set of t-shirt sizes
and I'll say medium, small.
And this is maybe--
the back story with this example--
I've going to come up
with it on the fly.
OK.
Someone bought 10 t-shirts
of different sizes
and you're just telling
me the sizes right now.
So the first t-shirt was a
medium, second one was a small,
the next one was a medium, next one
was a small, and then we have a large.
OK?
So if this were a list, we'd expect it
to just print out what I just inputted.
But interestingly, I put this into
a set, which might be good or bad.
Let's see what happens.
So if I now print this, whoa.
You'll notice that the set
has removed duplicate entries.
So what's good and bad
about this situation?
Well, let's say I wanted
to keep a record of all
my purchases or something.
Then all of a sudden, by storing
all of this information in a set,
I've lost a lot of data
because I've squished it out.
But if you said, oh, Veronica,
here's a bunch of data.
I'm actually not really concerned
with the individual entries,
but big picture.
Would you let me know what
sizes you had available?
You know what I mean?
I know you sold 10 t-shirts, but what
were the sizes of those t-shirts?
Then that might be a great
situation where I say,
OK, yeah, sure, just
give me the entries.
I'll put the sizes in a set and
then just give you back that set.
Because that set will
remove duplicate entries
and will just be looking at, as you
can see, medium, small, and large.
OK?
COLTON OGDEN: Provoker1986, thank
you for the follow, by the way.
Sorry to interrupt.
VERONICA NUTTING: Oh, wonderful.
No, not interrupting at all.
COLTON OGDEN: We've
missed a lot of chat.
We'll get back up to that.
We're going to get a couple more
examples through before we dive back
into all of that.
VERONICA NUTTING: So again, big picture.
And you'll notice if I try
to index, it won't let me.
So sizes--
COLTON OGDEN: It's hard to type live.
I've realized that myself.
VERONICA NUTTING: So if this were a
list, which is not, if it were a list,
it would have square brackets and we'd
expect to be able to index into medium.
But this will say, does not
support indexing, again,
because of this really interesting
thing that we've talked about,
which is that sets aren't ordered.
COLTON OGDEN: Testament also to
Python's really nice error message.
VERONICA NUTTING: That's a
really nice error message.
Wow.
COLTON OGDEN: C can
sometimes just be nothing.
VERONICA NUTTING: I was going
to say, if this were C--
COLTON OGDEN: --let
alone clean messages.
But anyway.
VERONICA NUTTING: No.
Debugging in C is a really
interesting psychological experience.
COLTON OGDEN: Yeah.
VERONICA NUTTING: Debugging with ASM
is also stressful, but GDB is great.
COLTON OGDEN: Yeah,
GDB is very flexible.
I don't use it enough, but
I've seen it so many times.
It looks very powerful.
VERONICA NUTTING: It's
super powerful, yeah.
OK.
Cool.
I feel like we're getting
a lot of quick things.
COLTON OGDEN: Oh, they're just saying--
I think bhavik_knight says, "You
don't need to put everything in print
to output it."
You can just literally
type the variable.
VERONICA NUTTING: Yeah, true.
Beautiful.
OK, cool.
So let's think if anything else--
yeah, so we've talked about
lists, dictionaries, and sets.
And I think we might as
well jump into an activity.
COLTON OGDEN: Oh, yeah.
We could do that, yeah.
VERONICA NUTTING: Or
is there any other--
let's think if there's any other
things we want to explore--
COLTON OGDEN: I was going to say, maybe
some operations on the data structures,
like, for example, adding to a list.
VERONICA NUTTING: Yeah.
So let's create another list.
Newspapers equals-- so here's
a list of newspapers that I--
well, that one is-- whatever.
COLTON OGDEN: That's fine.
VERONICA NUTTING: --the
newspapers that I sell at my shop.
Now I want to change that because
now all of a sudden, I'm adding--
I'm starting to sell--
COLTON OGDEN: Taking a new inventory.
Selling another new newspaper.
VERONICA NUTTING: I will
now start supporting--
what's another newspaper?
LA Times.
COLTON OGDEN: Yeah, there you go.
VERONICA NUTTING: Sure.
Now if I print newspapers, we'll
see indeed that it's been added,
which is exciting.
Yeah.
So again, we can perform
little operations.
Like, let's say now I lost my business.
So I want to clear it.
Now there's nothing in my list.
Newspapers-- it's an empty list.
COLTON OGDEN: So that's an in
place operation on the list.
It will actually take--
when you call the
function on that list, it
will actually mutate the data structure
rather than return a copy of it
if you were doing something with it.
VERONICA NUTTING: Yes, yes, yes.
OK.
And then let's go ahead and--
COLTON OGDEN: Oh, you have-- so
[INAUDIBLE] says, [NON-ENGLISH SPEECH]..
VERONICA NUTTING: Oh!
[NON-ENGLISH SPEECH]
COLTON OGDEN: So [INAUDIBLE]
is one of our very active staff
members on the Facebook as
well, alongside-- she and Andre.
VERONICA NUTTING: Oh,
that's so exciting.
COLTON OGDEN: I see both of them often
together fielding a lot of the posts.
I didn't realize that she was
from Buenos Aires, though.
VERONICA NUTTING: That's so cool.
[NON-ENGLISH SPEECH]
COLTON OGDEN: I'll do a
little bit of chat here.
So "Optimization Python converts
literals and Python functions
into constants attached to the function,
as long as it does not have references
to unknown values at the time,
AKA a parameter for the function
to avoid recreating them each time."
That's good to know.
I'm sure there's a lot--
I haven't looked too much
into the Python opt--
underneath--
VERONICA NUTTING: Me neither, yeah.
I haven't done-- yeah,
mainly C++ optimization.
But Python optimization-- I
think the more abstract you get,
the more fascinating it must be to
come down all the way to a lower level
and see what's going on there.
Yeah.
COLTON OGDEN: "Import dis--"
I'm not sure what "dis" is.
VERONICA NUTTING: I also don't know.
COLTON OGDEN: Is that like saying
import this in just a joke?
I'm not entirely sure--
VERONICA NUTTING: I don't know, maybe.
COLTON OGDEN: --Adam Fighter.
Oh, yeah.
Gootecks saying, "Gooteck's
PogChamp means excitement."
"You can use the BTTV
extension to create
custom emotes, but only visible
to people who have it installed."
Oh, I see.
OK.
VERONICA NUTTING: Interesting.
OK.
COLTON OGDEN: Like a Chrome
extension for Twitch.
VERONICA NUTTING: Cool.
COLTON OGDEN: "There's also a limit
to how many customizations as well.
[INAUDIBLE] should be
the only preferable way."
Oh, yeah, back to what we
were saying about Python,
how they have that mantra.
There should be one, and
preferably only one way
to do something, like one ideal way.
VERONICA NUTTING: Interesting.
OK.
COLTON OGDEN: The Socratic
form way of looking at--
VERONICA NUTTING: I feel like
there's a bunch of different ways
to do everything and there
are different reasons
for picking every different way.
I'm not sure that I totally
agree with this Python mantra.
COLTON OGDEN: I think
oftentimes you'll get something
that's very close to
perfect in Python that you
would have a hard time figuring--
the way they designed the language.
But I think indeed,
I think it's the case
that you probably could find multiple,
equally eloquent ways to do something.
VERONICA NUTTING: Yeah, there are
trade offs to every design decision.
So I think it's a very
case by case situation.
COLTON OGDEN: "Import
zen," says gulyash,
which would actually
right the zen of Python,
if you want to try it
in the chat for people.
VERONICA NUTTING: Sure, yeah.
COLTON OGDEN: So import zen and
that should just trigger it.
No module named zen.
Is it import-- import this?
There it is.
So that's the--
VERONICA NUTTING: Wait, what is this?
COLTON OGDEN: So that's
the zen of Python.
So it gives you all of the
small catchphrases that define
the philosophy of Python, I guess.
"Beautiful is better than ugly.
Explicit about an implicit.
Simple is better than complex.
Complex is better than complicated."
A lot of these are add-- not adages, but
I guess tips that are pretty, I think--
VERONICA NUTTING: Oh, that's nice.
I didn't know this existed.
COLTON OGDEN: Pretty obvious--
VERONICA NUTTING: If "the implementation
is hard to explain, it's a bad idea.
If the implementation is easy to
explain, it may be a good idea.
Now is better than never."
Interesting.
"Refuse the temptation to guess."
COLTON OGDEN: [INAUDIBLE] that's Fatma.
She says, "Hello, Colton,
Veronica, regulars, and everyone."
Hey, Fatma.
Good to have you with us.
DJM earlier said, "Hi, all.
Glad you've tuned in.
Just because you're old, doesn't
mean she's that young, Colton."
When I accidentally said 10, I think
that's what he's talking about.
Making me look like a geezer.
Vipulbhi says, "Thanks, Colton.
That'd be great."
M Stu GT, "Werewolf,
really popular in VR chat."
M Stu GT, thanks for joining us.
VERONICA NUTTING: Oh, that's cool.
COLTON OGDEN: Mkloppenburg "I
learned Werewolf in IRC way back."
Oh, man.
VERONICA NUTTING: What's IRC?
COLTON OGDEN: It's Internet Relay Chat.
It's an old school instant
messaging type stuff.
It's still around.
Fatma says, "Veronica,
I am rooting for you.
25 under 25."
VERONICA NUTTING: Yeah, that's nice.
COLTON OGDEN: "I appreciate you guys
trying to read every message in chat.
But with increasing viewer count,
maybe probably manage to skip the chat
or keep tabs more often.
That could work, too."
Yep, that's true.
We're trying to do a
little bit better of it.
It's going to take a little
bit of practice, I think.
VERONICA NUTTING: Yeah.
COLTON OGDEN: And I don't know if
I read Provoker1986, but thank you
for the follow.
I think I read it.
I'm not entirely--
VERONICA NUTTING: Yeah, you did.
COLTON OGDEN: "Waves back
at Veronica," says Brenda.
[INAUDIBLE]
"I did some test on this a bit ago.
But when talking about a fast way to
check membership, a tuple or a list
is faster when less than
or equal to two items.
But greater than two, a
set is always faster."
Interesting.
I wonder if they've purposefully
made that optimization
because it's such a high use case
of two or fewer index couples.
That makes sense.
We should look at tuples, actually.
Do you want to write a tuple example?
VERONICA NUTTING: Sure, yeah.
COLTON OGDEN: Another data structure
that's very common in Python.
VERONICA NUTTING: Yeah.
I really never use tuples
except for in math.
COLTON OGDEN: Yeah, that's, I think,
probably the best use case for it.
Yeah, when you're using xy or xyz pairs.
VERONICA NUTTING: Yes.
Do you remember the exact--
COLTON OGDEN: So it's a parentheses
with multiple arguments.
So you can say xy, for example.
Just type x comma y.
And then equals and then a tuple--
I think you can actually do
it without the parentheses.
I think parentheses are optional.
VERONICA NUTTING: OK.
COLTON OGDEN: But you can now say 10--
you don't need the tuple keyword.
But you can just say
10 comma 15 and enter.
And now if you just
type x comma y, you'll
actually get it, see, with the
parenthesis, the syntax, the 10,
15 output again.
And so you can do this to variable
length tuples, whatever you want,
basically.
And there's a lot of
named tuples, which is
a class of x, kind of like a
small dictionary, which is cool.
And yeah.
VERONICA NUTTING: Interesting.
COLTON OGDEN: It's pretty neat.
Another data structure that
you'll see a lot used--
I guess per what userman said
about the efficiency of indexing.
VERONICA NUTTING: That's interesting.
I hadn't really thought about--
let me think about that.
I guess that makes sense for this
specific use case, it would be faster.
COLTON OGDEN: I'd have to look into
it and just see what they did with it.
But that's cool.
VERONICA NUTTING: It is cool.
COLTON OGDEN: [INAUDIBLE],,
"I just got here, Veronica.
You need to put everything in print.
You can use I slice to
index a set, technically."
VERONICA NUTTING: Oh, interesting.
I slice, OK.
COLTON OGDEN: Not too
familiar with what that is.
Let's take a look at that.
Oh, it's an itertools
function it looks like.
I slice.
Oh, you have to actually define it.
I'm not too-- I don't think I've
ever used I slice, actually.
VERONICA NUTTING: No, me neither.
OK.
Let's see-- interesting.
COLTON OGDEN: Oh, they're saying roughly
equivalent to in the documentation.
By the way, docs.Python.org
for you to look at--
VERONICA NUTTING: They're really great.
COLTON OGDEN: I don't know if you
want to pull up what it looks like.
VERONICA NUTTING: Sure, yeah.
COLTON OGDEN: Oyenbex, thank
you very much for the follow.
Appreciate it.
Thank you for joining us.
The docs.Python.org.
And then you can go-- so by
default, it's giving you 3.7.1,
which is the newest version of Python--
the newest properly
released version of Python.
They might have a beta in progress.
I'm not sure.
But you can search by
version at the top.
So at the very top, you can
choose between Python 3.7,
you can choose 2.7, 3.6, 3.5.
Those are the main supporting
versions at the moment.
This would be something
that you look at when
you want to find what functions
exist for a given module, like lists,
for example.
Well, I guess-- and that would
be like built-in functions.
That would be part of the
built-in functions page.
But for example, if
you wanted to look at,
how do I use the CSV class,
which is a nice class.
VERONICA NUTTING: Yeah.
COLTON OGDEN: We use
that to parse CSV entries
and generate quizzes from those for,
for example, the business school class.
Take a CSV and iterate through
it and generate rows of lists
or generate-- sorry, a list of lists.
So one list for each row of
the CSV, which is pretty cool.
And you can you have options, actually,
to make dictionaries if you wanted to.
So for example, your header is name,
age, date of birth, whatever it is.
VERONICA NUTTING: Yeah.
COLTON OGDEN: You can actually have--
VERONICA NUTTING: Yeah,
with dict writer--
COLTON OGDEN: Yeah, exactly,
dict reader, dict writer.
VERONICA NUTTING: Yeah, the Python
docs are really, really great.
I think it's great when the actual
programming language produces
really, really great documentation.
COLTON OGDEN: David actually does
not like the Python documentation.
VERONICA NUTTING: Really?
Why does he not like it?
COLTON OGDEN: I'm not 100% sure.
At times, it can be lacking in
information for some functions.
VERONICA NUTTING: Interesting.
OK.
COLTON OGDEN: And I think it
could use a little bit more code
snippets for a lot of the parts.
But in general, I find that
I can get through with them.
But yeah, I think I do
understand what he means by--
VERONICA NUTTING: I
like the Python pages.
I like the Linux main pages.
COLTON OGDEN: He's a fan of the PHP--
he's a big fan of the PHP manual.
"Every two to five minutes, that
way it does not build up too fast."
Yeah, we got mixed philosophies.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Userman says we should
read every two to five minutes.
And then JP Guy saying we should
probably not read it as much.
It's hard to find that balance, but
I'm working on it, trying my best.
Stream by stream, we'll figure it out.
VERONICA NUTTING: Exactly.
And I think-- it seems like
quite a large volume of messages.
COLTON OGDEN: Yeah, it's growing a
lot every single time, which is great.
"Tuple can be used to make dictionary
keys because they are immutable."
I have to see--
dict tuple has keys.
Yeah, that's another thing about
tuples, they are immutable.
You cannot change them,
you cannot index into them.
They are data that you can get.
It's read only information.
VERONICA NUTTING: You might use it
if you wanted to store information--
I don't know, like a point in
3D space or something like that.
COLTON OGDEN: I'm trying
to find the exact usage.
Oh, you're using tuples as keys.
Right.
So you can actually--
you have a dictionary.
Because they're immutable, because
they're only going to get one value,
essentially they equate to a hash--
the equivalent of a hash.
You can say d and then use one, two--
let me just verify this before--
VERONICA NUTTING: Sure, yeah.
COLTON OGDEN: Two,
three equals Veronica.
Right.
Oh, I screwed that up.
So d equals and then make a dictionary.
And then I can say d, one, two, three.
And I forgot to put
the parentheses there.
That is equal to Veronica.
Let's see if that works, which it does.
So now I can say print d and that works.
So you can type that
example if you want.
VERONICA NUTTING: Let's do it.
COLTON OGDEN: So we created
an empty dictionary first.
VERONICA NUTTING: Yeah.
And one thing to note about empty
dictionaries, just to jump right in,
you'll notice that we're, again,
dealing with the curly braces, which
is something that we looked
at with sets, as well.
So how do you declare an empty set?
You can't just do this directly.
So two empty curly braces will
produce an empty dictionary.
But if you wanted to create an
empty set, we have to do this.
COLTON OGDEN: Use the set constructor.
VERONICA NUTTING: Tiny thing
just to remember that, again--
COLTON OGDEN: Good thing to bring up.
VERONICA NUTTING: Yeah, the empty set--
but creating an empty
dictionary might look like a way
that we'd create an
empty set, but it is not.
Cool.
COLTON OGDEN: And userman2
says, "Tuples can only
be used as keys as
long as the stuff in it
is hashable and preferably
immutable, as well."
Yes.
VERONICA NUTTING: Two--
COLTON OGDEN: So right now
we're creating a tuple,
and then we're going to use
it as a key in the dictionary.
And then we can assign it the string--
whatever-- Veronica.
We can assign it any value we want to.
But now if we were to do that and
then just output d, what we'd get
is a dictionary key
that's actually a tuple.
So it's a cool thing.
VERONICA NUTTING: That is cool.
COLTON OGDEN: I've never used
it in day to day programming,
but maybe you'll find a use case where
that just makes sense for something.
VERONICA NUTTING: Interesting.
Yeah.
COLTON OGDEN: Partly because
they're very flexible.
VERONICA NUTTING: I can't think
of any use cases for that,
but that's some cool
functionality for sure.
OK.
COLTON OGDEN: "Have you done
file operations already?
If not, can you read from a
doc, et cetera, beyond a CSV?"
A file operation-- so
you can read from a doc.
So doc files are XML-based documents--
XML-based files.
So it's a little bit complicated.
VERONICA NUTTING: That's
interesting, yeah.
COLTON OGDEN: Yeah, there's some
custom XML format for docs, though,
that has all the styling
information and whatnot.
CSVs are simple because CSVs
are only comma separated--
VERONICA NUTTING: Yeah, so you can
parse them by looking at commas.
COLTON OGDEN: Exactly.
VERONICA NUTTING: Anytime we're
dealing with a file that's
either comma separated or set up
where every line is its own thing,
it's usually pretty easy to
extract information from.
COLTON OGDEN: "You don't need
the parenthesis for tuples
in doing d, one, two.
[INAUDIBLE] converts--" oh, right.
Yeah.
VERONICA NUTTING: OK.
COLTON OGDEN: Cool.
Makes sense, yeah.
Just like when you use it for variable
unpacking, which we showed earlier.
VERONICA NUTTING: Yeah, we didn't
have to put the parentheses.
COLTON OGDEN: Correct, yeah.
VERONICA NUTTING: OK.
Cool.
COLTON OGDEN: All right.
I think we're caught up on chat.
So maybe let's dive into one of
the meteor things that you have.
VERONICA NUTTING: Sure, yeah.
So it's a fun thing.
So I just looked up a list of US
presidents and have this just as a text
file here because I was having a
conversation with one of my block mates
about diversity in politics.
And you always hear the
statistics of how many
women are in Congress, how
many non-white people are
in Congress, et cetera.
And if you look at US history, it's
very much one small group of people.
And she was like, oh,
how many first names
do you think we have in US presidents?
Because it's, again, not a
very diverse group in terms
of names or really anything else.
So I was like, oh, that's fun, actually.
So I think just using
this text file let's
us practice a bit of what we've
learned and discussed already
with data structures, and again,
try to do fun stuff with this data.
COLTON OGDEN: OK.
Sure.
Let's take a look at it.
VERONICA NUTTING: Yeah, let's jump in.
Just for fun, I'll put that here.
OK.
So basically, the first thing I'm
going to do is I'm just going to--
COLTON OGDEN: So you have a new
script here called Twitch.pi.
Right.
And then this information is a
text file called presidents.txt.
VERONICA NUTTING: Yeah, I don't know why
I can't make this little thing bigger.
But--
COLTON OGDEN: Oh, I'm not sure.
I don't use Atom too much.
VERONICA NUTTING: What do you use?
COLTON OGDEN: I use VS
Code, which is similar.
VERONICA NUTTING: Interesting.
Not Sublime.
COLTON OGDEN: Yeah, no, not Sublime.
VERONICA NUTTING: OK.
So basically what I'm
going to do right now
is I'm just going to essentially open
presidents.txt and store it in a list
where every element in
the list is one line.
So one thing that we don't see is
that at the end of each of these lines
is a backslash n, which signifies
the start of a new line.
So what I'm doing right now-- and the
order might seem a little bit funky,
but we'll explain in a second--
is I'm going to go ahead and strip the
backslash n on each of these lines.
COLTON OGDEN: For specifically R strip,
which is the right side of the strip.
VERONICA NUTTING: Yeah.
And actually, I'm
going to go ahead and--
yeah, for line n, open--
and then I think the file
is called presidents.txt.
OK.
COLTON OGDEN: Userman, "I always
use PyCharm for Python code stuff.
It's very good for pure Python, but
I like Sublime for quick edits."
I haven't used PyCharm, but I've
heard so many good things about it.
I have to take a look at it.
Sublime I used to use a lot.
VERONICA NUTTING: Really?
COLTON OGDEN: Yeah, Sublime is great.
Sublime is really good.
It's really fast, really efficient.
I don't know.
I guess I chose Atom for
some reason or other.
I think it had some other shortcuts
and plug-ins that I liked.
And then I switched to VS
Code for the same reason,
except it was a little bit more
memory conservative than Atom
is and had some cool support and
is being very actively developed.
But they're all interchangeable,
they're all interoperable.
VERONICA NUTTING: What
makes Sublime fast?
COLTON OGDEN: It's a C++ editor,
as opposed to Atom and VS Code
our electron shell editors.
VERONICA NUTTING: Interesting.
COLTON OGDEN: So they're
basically running a web browser
and using that as your text editor--
or the back end of a web browser.
VERONICA NUTTING: OK.
COLTON OGDEN: But we
should talk about this line
because this line actually
has a lot of stuff in it.
VERONICA NUTTING: Yeah,
let's break it down.
Cool.
So first, we're using open.
So we're just looking for--
we're going to open this file,
whatever we pass in here.
In this case, again, I have-- if we go
back here, it's a little hard to see,
but here I have a just a text
file called presidents.txt,
which, again, just contains
information on all the US presidents.
And it's not a CSV file.
This one is actually
organized by data in lines.
So if you're dealing with a CSV file,
usually what you're looking for is,
how can I cut up data or cut
up strings based on commas
and usually, also, based on new lines?
But in this situation, we
actually have no commas,
so we can just directly figure out where
to cut our string based on new lines.
Because again-- so one thing
I like to remind people of.
So we look at this text file.
And it looks pretty
straightforward, nicely organized.
I can read it and it looks like
everything is line by line.
But our computer is really seeing
this as one giant string, right?
One giant string.
And what we're not seeing
here is the backslash n.
So the computer is seeing
it as strings, where
every string is terminated
by a backslash n
so that it's displayed to
us as being on a new line.
OK?
So when we open that file--
when we're here and we just open this
text file, it's really one long string.
But we can use a for loop to,
essentially, go through and get
every single line from that text file.
But again, if we just did
that, that wouldn't be enough
because we need to strip
each of those lines.
We need to remove that little backslash
n that indicates to the computer
that it should present that
text file on a new line.
OK?
So again, this first step--
we've put a lot in one line.
But again, essentially what we're
doing is we're going into our text file
and we're saying, hey,
please, let's create
a list where every element in the list
is an individual line in the text file.
And then, because we want
to be treating each element
in the list as a line in human
terms, not in computer terms,
let's go out and remove
that backslash n.
OK?
COLTON OGDEN: For Sunlight,
Fatma says, "Can we print that
file to see the backslash n?"
VERONICA NUTTING: Sure.
Oh, yeah.
Sure.
So let's go ahead and we can maybe--
I'll comment this out.
Oh, no.
OK.
Let's go ahead and--
cool.
We could factor in the
editor, too, but whatever.
I'll just do Python 3 Twitch.py.
Oh, no.
Invalid syntax for a line in open.
OK.
So I guess I do need that for there.
OK.
COLTON OGDEN: You could
just say line for line.
VERONICA NUTTING: Line for line.
Oh, yes.
Beautiful.
Awesome.
OK.
So let's just take a look and
see what's happening here.
So again, as we talked
about, we have a list
of strings where each string is
every single line in our text file.
But again, remember, in order to
see our text file in this format,
our computer attaches a backslash
n to every single line, again,
just to indicate that when
it's explaining it to the user,
it needs to do that on a new line.
So when we actually go
through and truncate
that big string that is our text
file into different chunks, what
our computer is doing is it's
just saying, OK, awesome,
yeah, I'll truncate
it at the backslash n.
But it's not really
removing the backslash n,
which is why we're seeing
the backslash n here.
COLTON OGDEN: Exactly.
VERONICA NUTTING: OK?
COLTON OGDEN: And we could probably
just output the raw string, as well,
if you were just to print
open presidents.txt.
VERONICA NUTTING: That's a good idea.
COLTON OGDEN: And also, userman
says, "The strip function will
auto remove line breaks and white
space if nothing is passed to it."
Just a regular strip function.
So we can use them interchangeably.
VERONICA NUTTING: OK.
And we can also strip based on
other things, like commas or spaces
or other things.
So we can do that later.
But yeah, just for fun, we
could print out the full thing.
I'll just say, full equals
open presidents, just
to show people what
that would look like.
And then I'll go ahead and--
COLTON OGDEN: Userman2 has followed.
Thank you, userman2.
VERONICA NUTTING: OK.
And comment--
COLTON OGDEN: Oh, I guess we
turned off follower-only chat.
That makes sense.
VERONICA NUTTING: What do you mean?
COLTON OGDEN: Because there's the
thing where you can have followers
only can chat and then you can
have just anybody can chat.
Clearly, if userman2 wasn't following--
he's been chatting the whole time.
And actually, Brenda
was the other day, too.
VERONICA NUTTING: Interesting.
COLTON OGDEN: So follower-only
chat is not currently enabled.
VERONICA NUTTING: OK.
So actually, I don't think we
can just print out the full file.
But that's fine.
COLTON OGDEN: Oh, because it's a--
you have to do the dot read function.
So call dot read on that
open at the very end.
Now try that.
Because you're getting
a file I/O object.
There we go.
But it actually will output it--
when you call it to
print, it will actually
output the string printed properly
to the COI, which results in-- yeah,
you're not actually
getting the actual data.
I think you can call bytes--
the bytes function on that.
VERONICA NUTTING: So
instead of read or--
COLTON OGDEN: So you would call
bytes over this whole thing.
VERONICA NUTTING: Or can I do directly--
COLTON OGDEN: Or maybe
you can use dot bytes.
Yeah, maybe you can.
I'm not 100% sure.
VERONICA NUTTING: We'll try it.
COLTON OGDEN: No.
I think you have to cast it
to bytes, with calling bytes
over that whole thing.
VERONICA NUTTING: I see.
COLTON OGDEN: It's been a little while.
VERONICA NUTTING: That's interesting.
Oh, I was going to say,
always stressed when--
COLTON OGDEN: Oh, we need an encoding.
So utf-8 I guess, the second
argument to that after bytes.
Yeah.
And then comma-- as a
string, utf-8, lowercase.
It has to be a string, though.
VERONICA NUTTING: Beautiful.
COLTON OGDEN: Let's try that.
There we go.
And now we can see the new ones.
VERONICA NUTTING: Yes.
OK.
So exactly.
So again, we'd have to parse
through step zero of doing anything.
Manipulating anything with data is going
through and then parsing it in a way
that you can then
manipulate more easily.
So again, here we have this text file
that looks quite straightforward when
we're reading it, but everything is--
it's really just one long string with
backslash n's sprinkled throughout.
Cool.
So now let's go back to our program.
COLTON OGDEN: Userman2 has
a couple of suggestions.
"Might want to choose the with
statement since it's good with files."
Yep, that's a good idea.
We might be able to do that.
And then userman2 says,
"Read dot encode, also."
The dot encode function would replace
the bytes, which would help us out.
VERONICA NUTTING: Oh, sure.
COLTON OGDEN: A little bit cleaner.
But it's OK.
We don't have to
necessarily demonstrate it.
But yeah, thank you very much, userman2.
But yeah, the with open.
So you use the with statement
and that will basically
let you set aside a block in which
you have that file opened just
for the context of that block.
It's called a context manager.
So with open something as f indent.
And then you have access
to f as your file handle
VERONICA NUTTING: With open--
COLTON OGDEN: Yeah, with
open presidents.txt.
And then as-- space as f, or whatever
you want your file to be called, colon.
And then you create a new block.
So within that, you
now have access to f.
VERONICA NUTTING: Oh, interesting.
COLTON OGDEN: So you could
do print f.read, for example.
And probably comment out
those other lines above there,
just so it's not causing too much issue.
VERONICA NUTTING: Yeah.
Sounds good.
COLTON OGDEN: And then
save it and then run it.
And that should-- open
Chrome real quick.
VERONICA NUTTING: Force quit now.
COLTON OGDEN: And then we
should have-- yep, exactly.
So now we have access to f, but then as
soon as-- the nice thing about this is
you don't have to actually
call close on open at the end.
You normally have to do it anyway.
But this is just a little bit more,
I guess, secure and efficient.
And it's better from an
engineering perspective
because now you have f just for
the context that you need it.
It's not open for the
duration of your file.
VERONICA NUTTING: That makes sense.
Yeah.
Interesting.
COLTON OGDEN: Or the duration
or your script, yeah.
VERONICA NUTTING: Yeah.
OK.
Cool.
COLTON OGDEN: So thanks for
the suggestion, userman2.
Good suggestion.
VERONICA NUTTING: Do you
want to keep with open?
COLTON OGDEN: We can do that, but your
script uses the lined up r strip--
the list comprehension.
VERONICA NUTTING: Yeah.
COLTON OGDEN: So another thing
we should have maybe talked about
is that list comprehension--
what the list comprehension is.
Because you did talk about it.
But the idea of the
list comprehension is
that it should be enclosed in
the list brackets, for example.
VERONICA NUTTING: Yeah, OK.
So let's maybe--
COLTON OGDEN: "I love Python's
context manager," Caesar [INAUDIBLE]..
Yeah, they're really cool.
VERONICA NUTTING: What
is the context manager?
COLTON OGDEN: It just basically lets you
define a start and an end to something.
VERONICA NUTTING: OK.
COLTON OGDEN: So if you need something
to happen after something finishes
executing, which typically is file
dot close on a file, for example,
you can define a context
manager for it such
that it will call that
automatically for you.
So what happens is the with open
will actually trigger the f.close
when it comes out of scope.
VERONICA NUTTING: Automatically.
COLTON OGDEN: And then it's
given behind the scenes.
VERONICA NUTTING: Yeah.
Oh, that's great.
COLTON OGDEN: And you can do
that for anything that you want.
You can have anything happen behind the
scenes for any given class or object.
VERONICA NUTTING: OK.
What else?
COLTON OGDEN: I haven't
done it in a long time.
There are other uses for it.
I have seen it.
I can't come up with it
at the top of my head.
But maybe you want to do a database
commit or something on something
while you're doing the
work or save something,
or maybe you want to trigger
some other operation.
VERONICA NUTTING: And you
want to do contained--
COLTON OGDEN: Yeah, something
that should happen on exit.
VERONICA NUTTING: You said safer?
COLTON OGDEN: Yeah.
And then it also, just from
a programming perspective,
limits the scope of what you're doing
to a particular block as opposed
to just being top level, which is--
VERONICA NUTTING: That's cool.
Good suggestion.
Wow.
Yeah, userman2 is really--
COLTON OGDEN: Yeah, a
lot of great suggestions.
"Electricity is gone.
PC was shut down.
But I'm, from phone, trying to give
one example," says bhavik_knight.
Yeah.
VERONICA NUTTING: OK.
We'll wait for that.
COLTON OGDEN: "Anything that has
enter and exit can be used with with."
Yes, that's the protocol for context
managers that enter and exit.
Again, those underscore functions
are hidden functions that
let you define how your object's work
with one another, like [INAUDIBLE],,
for example.
VERONICA NUTTING: Yeah, that's cool.
OK.
That's exciting.
This is fun.
OK.
So next thing I want to do--
OK.
So there's a lot of things that
we can do this information,
but one thing I noticed
when I was scrolling through
is like a lot of James.
COLTON OGDEN: A lot of
repeated first names.
VERONICA NUTTING: James, James.
Lots of Williams.
William.
Lots of Johns, et cetera.
And I was like, oh, there
are a lot of reasons.
These are common names
for a bunch of reasons.
But I was curious, what's the
proportion of total presidents to number
of individual names?
And a bunch of other fun
stuff like that that we
can do with a basic list of names.
So I was thinking we could do
something like, I'll create
maybe an empty list called first names.
And then when I want to iterate over.
And again, we've already
looked at what lines
is, which is currently a list of strings
where each string is just the text
that we have in one line of our text
file, again, with no backslash n.
And what I'm going to do is just
for i in lines, first names.append.
And then I'm going to
do i.split, actually,
because I want to split this by spaces.
And then zero.
OK.
So I've also done quite a lot here.
Let me just go ahead
and print first names
and then we're going to
talk about what's going on.
COLTON OGDEN: Dissect it.
"James and William, exclusive file.
Kappa," says userman2.
VERONICA NUTTING: James
and William exclusive--
COLTON OGDEN: I think he's
basically saying there's
a lot of James and Williams in there.
Basically, only James and Williams.
A lot of Georges, though.
VERONICA NUTTING: Lots of Georges.
Yeah.
Again, I just think it's--
we've had a lot of
presidents, but they've all
been the same in a lot of ways.
OK.
Moving on.
Yeah, so basically what we're
doing here is we're just saying,
hey, for every element
in our list, and again,
remember, we currently have a list
of strings, go ahead and append--
just add to our empty list first names.
So i.split square bracket zero.
So what I'm doing here is I'm
saying, hey, for whatever string
that we are currently on,
because, again, here we're
iterating over all of the strings--
each of the strings in
our list of strings--
for the string that we are currently at.
Please go ahead and split it by--
so split will automatically
split by spaces.
So it's going to split this into spaces.
And then this will become its own list
of strings that are split by spaces.
And then what I'm doing is I'm indexing
into just the first thing there.
And the reason I'm doing that is
if we go back to our text file,
you'll see that if we're
at this specific string
and I split it by spaces, I know
that at the zeroth index for any
of those strings that
have already been split,
I'm going to be looking at a first name.
And for the sake of this
example, that's the information
that I'm currently interested in.
So--
COLTON OGDEN: And this
definitely relies on you
having a consistent data set, too.
VERONICA NUTTING: Interesting.
Consistent in terms of--
COLTON OGDEN: In making sure
every single line fits that 100%.
Because it'd be unfortunate
if you, for example, had
a first name missing or somebody
entered their data in the wrong order.
VERONICA NUTTING: Yes, yes, yes.
COLTON OGDEN: And userman2
also makes a point.
He says that, basically, a for
loop mixed with a list with a pin
can just be made into
a list comprehension.
VERONICA NUTTING: Interesting.
COLTON OGDEN: Do you want to
maybe demonstrate what he means.
So basically doing this to this.
So we'd say first names equals, and
then it would be i.split 0 for i
in first names.
VERONICA NUTTING: First names equals--
COLTON OGDEN: And you would
basically take this part here,
which is the i.split.
VERONICA NUTTING: Yeah.
Are you saying-- oh, like for line in--
COLTON OGDEN: For i in
lines, in this case.
VERONICA NUTTING: OK.
COLTON OGDEN: So you would do that.
VERONICA NUTTING: i in lines.
COLTON OGDEN: And then you
would put that at the beginning.
No, you would put that
part at the very beginning.
Yeah, exactly.
So that's taking us--
because you're getting
this i from the for loop.
VERONICA NUTTING: That
makes sense, yeah.
COLTON OGDEN: And then you can do this
to it and that'll get put into there.
Exactly.
And then you can just get rid of this.
And to his point, it is
definitely more elegant.
VERONICA NUTTING: Yeah,
let's go ahead and do that.
Sounds good.
COLTON OGDEN: And so now we
should be able to print it out.
It should work, right?
VERONICA NUTTING:
Yeah, this should work.
Awesome.
COLTON OGDEN: So thank you,
userman2, for that suggestion.
VERONICA NUTTING: Good design.
Yeah.
Cool.
So now we've gotten to
this, which is exciting.
And I guess we can't really have
people immediately jumping in.
But do you have a sense of
what data structure might
be really helpful if we wanted to--
COLTON OGDEN: Oh, to get a sense of--
VERONICA NUTTING: OK.
Actually, before we do that,
let's go ahead and do print--
I'll do print f the total
number of US presidents is--
first names, just for fun.
COLTON OGDEN: Oh,
bhavik_knight had a suggestion
for a dictionary comprehension.
That's correct, yeah.
Maybe we'll take a look
at that in just a second.
VERONICA NUTTING: Yeah.
COLTON OGDEN: "A named tuple
would be good for grouping
CSV data into a structure with
attributes," says userman2.
Yes, agreed, definitely.
If you want to sort this
dictionary, it would be
like-- oh, bhavik_knight's suggestion.
VERONICA NUTTING: OK.
Cool.
So currently--
COLTON OGDEN: Oh, another
demonstration of the f string, as well.
Love it.
VERONICA NUTTING: Yeah, another
demonstration of the f string.
And basically what I've done here is,
before doing anything else with a list
that we currently have of first
names, I just said, just for fun,
let's let len do the work of calculating
how many US presidents we've had.
And again, we just formatted this string
to output the length of this list,
which, again, length, when we're dealing
with lists, is number of elements.
Remember, we also used length
with an individual string
and that gave us the number
of characters in the string.
But in this case, it's
the number of elements.
Cool.
So now that we know the total number
of US presidents is 45, let's go ahead
and we can cast first names as a set,
and that'll give us the same data,
but with duplicates removed.
So let's say we wanted
to find out what's
the total number of individual
US president first names.
We could print out the length of
elements in a set of the first names.
Because, again, it would
automatically remove duplicates.
So you can go ahead and do that.
So I'll do set names, just to
keep it clear what we're doing.
COLTON OGDEN: Good variable
naming, very important.
VERONICA NUTTING: Set first names.
And then I'll go ahead
and say just copy that.
The total number of US
president first names is blank--
I think I called it setnames.
COLTON OGDEN: And then also,
another great demonstration
of using the len on two
different data structures.
VERONICA NUTTING: Two different data
structures, yeah, which is really cool.
So again, it's just number of elements.
So that, to me, is a
remarkable difference, right?
So we have total number
of US presidents is 45.
But-- oh, my head is in the way.
But it looks like we have a
total of 30 total first names.
COLTON OGDEN: I was actually
thinking it was going to be fewer.
I'm surprised.
VERONICA NUTTING: You thought
it was going to be fewer?
COLTON OGDEN: I thought it was
going to be 15 first names, or 20.
VERONICA NUTTING: Interesting.
I'm actually curious, which
are these first names?
Let's go ahead and print first names.
Well, Barack and Donald--
COLTON OGDEN: That's true.
And Andrew for Andrew Jackson.
Oh, Gerald.
Yeah, I guess we have a fair number.
Dwight-- Dwight is a--
oh, Ulysses.
I forgot about Ulysses.
Ulysses is such a
different class of name.
VERONICA NUTTING: Rutherford.
I didn't realize that was his--
COLTON OGDEN: Yeah, Rutherford B. Hayes.
That's an old school name.
That's not a name you see anymore.
VERONICA NUTTING: OK.
This is interesting.
Actually, I'm not sure why this is--
COLTON OGDEN: Oh,
because did you print--
oh, you didn't print
setnames, that's why.
VERONICA NUTTING: Oh, [INAUDIBLE].
COLTON OGDEN: There we go.
VERONICA NUTTING: I was going to
say, that feels like a long list.
OK.
Wonderful.
And again, you'll notice
these aren't ordered.
But we could order them
perhaps by casting it to a list
and then calling the sort
method to print it out.
OK.
What's another thing we want to do with
this data set that you can think of?
COLTON OGDEN: That's a good question.
Maybe count how many occurrences
of each individual name?
VERONICA NUTTING: Oh, yeah.
So I might go here and I can do print.
So my dad's name is William.
So I'm going to go
ahead and count William.
COLTON OGDEN: Nice.
VERONICA NUTTING: And
I'll go ahead and say--
COLTON OGDEN: Oh, "Average
name length," says userman2.
VERONICA NUTTING: Oh, that's cool.
Yeah, we can do that.
OK.
The number of Williams as--
COLTON OGDEN: And we have Nicholai with
the ever wonderful contributions there.
Thank you very much for that.
VERONICA NUTTING: What?
What?
COLTON OGDEN: Uh-- kid friendly stream.
VERONICA NUTTING: OK.
And again, notice I'm obviously
doing the number of Williams
as presidents is first
name count William.
So what I'm doing here
is I'm saying, hey,
please go into our list of first names
and just count the number of times
that you find this.
COLTON OGDEN: And I didn't realize
that you were doing this before,
but you're actually-- this is a great
thing about format strings, is you're
actually calling a function within
the template placeholder, which
is such a powerful thing you can do.
VERONICA NUTTING: Extremely powerful.
I think just can make
things really clear.
I think if I were reading this-- and I
could store this as x and then pass x
in.
But then if I were
reading the code later,
it wouldn't be immediately clear to
me what I was doing, versus, to me,
this is pretty clear.
I'm saying, OK, first
names, please count William.
COLTON OGDEN: Yeah, exactly.
VERONICA NUTTING: So I think
that's pretty clear to me.
Cool.
So I'm going to go ahead
and let's just see.
Oh, invalid syntax?
Let's see where that is.
Oh, OK.
COLTON OGDEN: Nicholai, "Just
showing off my skills, bro," he says.
"I'm basically kid friendly.
We'll do one about the correct
anatomically term," said Nicholai.
You're not wrong.
President of Mars, "Impressive--"
VERONICA NUTTING: I'm not sure
what I'm doing wrong with count.
COLTON OGDEN: First
names dot count William.
Sorry, what does it say?
What's the error?
VERONICA NUTTING: Just invalid syntax.
Pretty sure this is the right syntax.
COLTON OGDEN: Oh, because
you're using inner quotes.
You need to use apostrophes because your
string is delimited by double quotes.
VERONICA NUTTING: Yes, beautiful.
OK.
Awesome.
Oh, yeah.
OK.
The number of Williams
as president is four.
COLTON OGDEN: Go Williams.
William is a very
common name, to be fair.
VERONICA NUTTING: True.
I think if I were writing a paper on
this, I think the next steps I would do
is get a bunch of data
on how many people
were born at all these different
years that had this name.
I'd try to figure out when these
four Williams were president,
how common was William as a name?
COLTON OGDEN: I think it was.
Certainly the demographics of our
country have changed so much, too.
VERONICA NUTTING: They have, yeah.
COLTON OGDEN: I think for our first
200 years, we were very not diverse.
And it seems like we've grown a lot,
thankfully, in the last 50 years.
VERONICA NUTTING: Yeah.
COLTON OGDEN: 50 to 100 years, probably.
I'd have to see when the demographic
changes have most occurred [INAUDIBLE]..
VERONICA NUTTING: Interesting.
OK.
I like the suggestion of
finding the average character
length of the first names.
I think that's fun to do.
COLTON OGDEN: Nicholai says, "Can you
explain why you cannot surround strings
with single quotes in C?"
VERONICA NUTTING: Yeah.
So essentially, I think I--
let's just go back and
see how that looked.
So you'll notice that--
actually, I think they are
mainly interchangeable.
But I think count--
COLTON OGDEN: No, it's because your f
string is delimited by a double quotes.
And what it thinks is that you're--
it's coming here and then
it's seeing this quote
and thinks that that's
the end of the string.
VERONICA NUTTING: OK.
So you think Atom is just
formatting it slightly differently?
COLTON OGDEN: It is, yeah.
Atom is smart enough to know what
you're going for, but Python is not.
VERONICA NUTTING: So this should
work if I switch it to single quotes?
COLTON OGDEN: Yes.
VERONICA NUTTING: And then the
inside thing is double quotes.
COLTON OGDEN: Yep.
That should work.
VERONICA NUTTING: Interesting.
COLTON OGDEN: But Nicholai
was wondering about in C,
why you can't surround
strings with single quotes.
VERONICA NUTTING: Interesting.
I think it's just a C thing, right?
That all of C, you need
to use double quotes.
And I'm trying to think.
We use single quotes--
COLTON OGDEN: For characters.
VERONICA NUTTING: Yeah, for characters.
And you can use three
single quotes for comments.
COLTON OGDEN: That's in Python.
VERONICA NUTTING: And Python.
Wonderful.
COLTON OGDEN: They all blend together.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Yeah,
it's a compiler thing.
VERONICA NUTTING: Interesting.
COLTON OGDEN: And then the
language, the grammar of C
requires that that be the case.
But Python has a different grammar for
us where the two are interchangeable.
Same with JavaScript, for example.
VERONICA NUTTING: Mm-hmm.
COLTON OGDEN: And it would be nice--
I'm partial to single quotes.
I like single quotes in--
VERONICA NUTTING: More?
COLTON OGDEN: Yeah.
Do you like double quotes more?
VERONICA NUTTING: OK.
So my sense is--
I think because I started
learning programming in C,
I always associate strings
with the double quotes.
COLTON OGDEN: Sure.
VERONICA NUTTING: And I
always see the single quotes
and feel like something is missing.
But obviously, in terms
of space and, arguably,
readability, those would
be a little bit easier.
Actually--
COLTON OGDEN: And you
don't have to hit Shift.
I think that's my water.
VERONICA NUTTING: Oh, that's your water?
Where'd I put my water?
COLTON OGDEN: Is yours
that one over there?
VERONICA NUTTING: I
think it's right there.
I"m going to grab it.
COLTON OGDEN: Oh, that one right there.
VERONICA NUTTING: I'm
just getting thirsty.
COLTON OGDEN: I don't
want to give you my germs.
"I [INAUDIBLE] separate scope where f
strings that string collisions cannot
happen."
"--a separate scope for f strings
that string collisions cannot happen."
I'm not sure what you're
referring to, userman2.
"How about the most popular name?"
Oh, the most popular name.
Yeah, we were going to
get to most popular name.
And then you said average
length of the names
was another thing you wanted to try out.
VERONICA NUTTING: Yep.
COLTON OGDEN: And "Is both
string in Py--" oh, yeah.
Both the quotes--
"Both strings in Python, doesn't
matter, default to a single quote,
unless we use a single
quote in the string."
Yeah, same with me, same with me.
VERONICA NUTTING: Interesting.
COLTON OGDEN: "Never understood why
they did it that way," Nicholai.
Yeah, there's this
thing called a grammar,
which is basically a large pattern--
and it's more complicated
than that-- but essentially,
a set of rules that text
written in C has to follow.
And the pattern is very
strict with the symbols
that it will expect for
different parts of the grammar.
And in the case of C, it is very strict.
It's not an or for the apostrophes in
quotes that it is Python or JavaScript.
It's very much hard set and that's
just the way the language has been--
VERONICA NUTTING: What
do you mean an or?
That it's a user choice?
COLTON OGDEN: You can't
use single or double in C,
like you can in JavaScript.
The grammar has an or at that point that
says, I will accept either of these,
unless you've used that
same character earlier.
In which case, it's going to end the
string there and trigger syntax errors
after that.
It's closing the string at that
point and trying to parse the string.
And it's seeing all this stuff that
it doesn't recognize after that.
And that's what's triggering the error.
VERONICA NUTTING: OK.
Cool.
COLTON OGDEN: You have
to escape, maybe, for it.
Oh, yeah.
And you could also do it this way.
You do the backslash quote,
per bhavik_knight's suggestion.
Strings in Python you can
escape with backslash--
VERONICA NUTTING: Just backslash?
COLTON OGDEN: Is it backslash
or is it double quote?
I think it's backslash quote--
VERONICA NUTTING: Like this?
COLTON OGDEN: Now I'm forgetting.
Because one of the languages--
I forget whether it's JavaScript--
I always avoid the issue by
just using the opposite quote.
But it's either double
quote or backslash
quote will let you escape the quote,
and then therefore use it inside
of another quote, if that makes sense.
VERONICA NUTTING: It semi makes sense.
COLTON OGDEN: "Backslash cannot be used
in f string fragments," says userman2.
Yeah, because I was seeing your
text editor wasn't working.
VERONICA NUTTING: It
wasn't super finding it.
COLTON OGDEN: ""[INAUDIBLE] to use double
quotes [INAUDIBLE] instead of string.
Otherwise, static--" yeah.
"You almost always backslash
or escape with the backslash."
Yeah, agreed.
VERONICA NUTTING: Nice, Plus One.
COLTON OGDEN: But I'm not sure in
Python how to do it off the top my head.
I'd have to google it.
VERONICA NUTTING: Yeah, fair.
Cool.
Yeah, I think it might
be fun to print out--
let's go ahead and maybe do a
for loop for i in first names.
OK.
So I'm just going to say
what I'm thinking first.
So I think it'd be cool to
go over the set of names
and go over the-- actually, no.
I think we should--
no, this won't work.
Let me think.
OK.
So I think it'd be
interesting to print out
essentially this string, the number of
Williams as presidents is et cetera,
but for every single name in
the set, if that makes sense.
I think that will work.
I think if I do for i in setnames--
COLTON OGDEN: Oh, I see.
Yeah, you're going to do count, and
then insert that number into a list.
VERONICA NUTTING: Print the number of--
COLTON OGDEN: Userman2, I'm
not sure if that is correct.
It's definitely the case, though,
that-- we just tested it--
that the string, if it is the same
quotes type as the parent quote type,
it will cause a collision.
So I don't think-- the
scope might be true,
but the actual syntax is such
that it doesn't take that
into consideration at the least.
VERONICA NUTTING: OK.
I think this will work.
For i in setnames the
number as presidents.
COLTON OGDEN: Oh, OK.
Sure.
VERONICA NUTTING: I think that'll work.
COLTON OGDEN: Firstnames.count i.
Did you make that a--
VERONICA NUTTING:
Firstnames.count i, exactly.
COLTON OGDEN: OK.
Yeah, that should work, right?
VERONICA NUTTING: It should work, yeah.
Let's see.
COLTON OGDEN: Yeah, that
looks right to me, right?
Yeah, George.
Yeah, nicely done.
VERONICA NUTTING: It doesn't order it.
COLTON OGDEN: It doesn't order it, no.
VERONICA NUTTING: OK.
Five Jamess.
OK.
I added an extra S just to--
COLTON OGDEN: Jamess.
VERONICA NUTTING: Jamess.
OK.
Cool.
And then we can order it.
But that's fun.
It's interesting.
And then, again, note
here that we've had
an interesting situation
where we're bringing together
both sets and lists, right?
Because we're iterating over our set.
And why are we iterating over our set?
Well, we wouldn't want
to iterate over our list,
because then we'd be printing--
we'd print out the number of
Williams as presidents is four,
we'd print that four times, right?
Because it would be iterating over
every name in our list of strings.
So instead, we're iterating over
every element in our set of names.
So that's the 30 names--
no duplicates-- 30 names of
first names of our presidents.
And then we are saying--
but when we are counting, we
want to be using our list.
Is that a follower?
COLTON OGDEN: [INAUDIBLE] at Twitch.
VERONICA NUTTING: Oh, cool name.
COLTON OGDEN: [INAUDIBLE] at Twitch.
Hopefully I'm reading that correctly.
And Dakota D. I missed that one earlier.
I apologize for that.
Dakota D, [INAUDIBLE] at Twitch.
Did I miss any other ones?
Nope, that's it.
VERONICA NUTTING: Userman2 we know.
COLTON OGDEN: Yeah, userman2 was the
last one that I remember reading off.
So thank you very much for the follows.
VERONICA NUTTING: Yeah,
thanks for joining.
So again, another super
cool example of a way
that we can bring together all the
functionality of sets and lists
and format them in a cool string.
And again, remember, we're
directly applying the count
method to the first names list and
counting the number of instances i,
where i is a first name in the set
of first names that we created.
OK.
Cool.
Any other suggestions as to
other fun things that we should--
any other fun ways to tinker with it?
I'm trying to think average.
Is average built into Python?
COLTON OGDEN: If you're looking
at a list, like the average--
VERONICA NUTTING: Like,
average length of characters--
if we did average length of
characters in a list of strings.
COLTON OGDEN: I have to look it up.
VERONICA NUTTING: Let's look it up.
COLTON OGDEN: I'm not entirely sure.
So Python--
VERONICA NUTTING: I think
it's built in, but--
COLTON OGDEN: I'm sure there
is a function like that.
Average of a list.
Some length-- geeks for geeks.
VERONICA NUTTING: Oh, so we could
do sum of all the characters divided
by number of elements in the list.
COLTON OGDEN: Yeah, sum
divided by length, yeah.
VERONICA NUTTING: OK.
That seems like-- sure, we can do that.
I'll go ahead and say average name--
average--
COLTON OGDEN: So you could make it
probably a list comprehension, right?
Could you?
VERONICA NUTTING: Sure.
COLTON OGDEN: No, you can
just put the number of-- so
if you're looking at
the set and then you
want to take the length
of each of those names.
VERONICA NUTTING: So I think it depends
on, are we looking at average of--
would we want William to count
four times as much as Ulysses?
COLTON OGDEN: I don't think so.
I think this would be on the set.
VERONICA NUTTING: OK.
Cool.
So we could do--
do you want to do directly
or we could do average--
COLTON OGDEN: Yeah, we could do
just name lengths, for example.
VERONICA NUTTING: Sure.
That's a good idea.
Name lengths.
COLTON OGDEN: And then we
can do equals, and then you
could make this a comprehension
where you could say,
len of name for name in setnames.
VERONICA NUTTING: Love it.
COLTON OGDEN: And then
what that'll do is
it'll give us all of the lengths
for the individual names.
And if you wanted to make it a
proper average of all the names,
you would just change
that to first names,
and that would give
you all of the names.
VERONICA NUTTING: So slightly
weighted distribution.
COLTON OGDEN: Yeah, it is.
VERONICA NUTTING: OK.
So let's try that first.
So this is unique first
names in our US presidents.
Let's go ahead and see-- oh, I hate that
we have all these print statements now.
Oh, print name lengths.
Oh, OK.
So we want to print--
COLTON OGDEN: So 10 I'm
guessing is Rutherford
because that's the longer one.
So average isn't actually a function.
VERONICA NUTTING: Really?
COLTON OGDEN: So you would need to do--
VERONICA NUTTING: Oh,
we do need to do the--
COLTON OGDEN: The length of names--
VERONICA NUTTING: Wouldn't we do sum?
COLTON OGDEN: You would do sum
of name lengths, exactly, divided
by length of name lengths.
And then that will give you the average.
And I think it was Brenda.
So thanks to Brenda for the
suggestion who asked us to do that.
VERONICA NUTTING: Oh, 10.
COLTON OGDEN: Rutherford.
VERONICA NUTTING: Oh, Rutherford.
Yeah, yeah.
COLTON OGDEN: Nice.
6 and 1/2, roughly.
6 and 1/2 characters is the average--
VERONICA NUTTING: I want to
do-- let me see first names.
Because I think--
COLTON OGDEN: So the
unweighted average or whatever?
VERONICA NUTTING: So
this would be weighted.
COLTON OGDEN: Oh, weighted.
Yeah, right.
VERONICA NUTTING: So
weighted-- now we're
taking into account
all of the first names.
And let's go ahead and,
again, do some more fun math
where we're trying to figure out-- see,
I think this is going to be higher.
Because I think William--
COLTON OGDEN: I think
so, yeah, probably.
There's a lot of Georges, though.
George is six.
VERONICA NUTTING: J-A-M-E-S. OK.
COLTON OGDEN: And James is five.
VERONICA NUTTING: So I'm going
to guess that it's higher.
COLTON OGDEN: Oh, it's lower.
VERONICA NUTTING: Wow.
COLTON OGDEN: Wow.
OK.
VERONICA NUTTING: Who is--
OK.
James is five.
COLTON OGDEN: So James is pretty small.
There's five James.
VERONICA NUTTING: Interesting.
Franklins.
Franklin?
COLTON OGDEN: I don't know.
That's crazy.
There's a lot of them that are six.
Barack is six.
John-- oh, John.
There's four Johns.
VERONICA NUTTING: Oh!
It's the Johns that are
bringing this average down.
COLTON OGDEN: It's the Johns and James.
VERONICA NUTTING: Johns and James.
Wow.
OK.
So this is fun.
I think Python math is
also super fun to do.
COLTON OGDEN: Yeah, it's so easy, right?
VERONICA NUTTING: Lots of built-in
stuff that we can directly do.
COLTON OGDEN: Oh, man.
I do not know how to read that name.
That is in Chinese, I do believe.
VERONICA NUTTING: Looks
like Mandarin, yeah.
COLTON OGDEN: Yeah.
I-- I can try and--
VERONICA NUTTING: Sound it out?
COLTON OGDEN: Not copy it, but--
no, I don't know how
to read [INAUDIBLE]..
But if I did, I would give it a try.
Unfortunately, I don't.
But thank you very much for
the follow, whomever that was.
If anybody knows how to pronounce
that, definitely let me know.
I probably would butcher it
because I don't know how to read--
I don't know the tones in Chinese.
VERONICA NUTTING: Yeah.
Oh, no.
I was actually just talking to a
student that for his final project
might do a Mandarin tone mastery--
COLTON OGDEN: Oh, that'd be so cool.
VERONICA NUTTING: Isn't that cool?
Yeah.
COLTON OGDEN: Oh, we
got a bunch of stuff.
VERONICA NUTTING: Yeah.
OK.
Yeah.
So again, there's tons of
different ways to do this.
This is the very step by step--
COLTON OGDEN: Oh, Nicholai was
asking about the f strings.
Yep, just basically allowing you
to put variables inside the string
as opposed to the other
messier ways to do it.
And we went over some of those.
VERONICA NUTTING: Like,
string concatenations.
COLTON OGDEN: Yeah.
"For i in set--" yep, first names.
"Wonder what the performance would be
over loss over print f or s print f."
Good question.
I'm not sure.
Probably not super intense, unless
you were printing thousands of things.
VERONICA NUTTING: Yeah.
COLTON OGDEN: I'm not sure.
VERONICA NUTTING: Interesting.
COLTON OGDEN: But whoever--
VERONICA NUTTING: Nicholai, good font.
COLTON OGDEN: Yeah, Nicholai said,
"Time it and compare with s print f."
Yeah, for something like
this, the timing difference
is honestly going to be inconsequential.
You would really only
notice it if we were
to do hundreds or millions-- hundreds
of thousands or millions of entries.
VERONICA NUTTING: Which there
are databases that are that big.
So I think anytime we're manipulating
data in any way, scalability
is something that we really are
going to want to care about.
So actually, I think a lot
of these design questions
are definitely coming
from the right place.
COLTON OGDEN: It's great to
think about the type of thing
as you wonder about scaling up.
VERONICA NUTTING: "So we could use
a couple of different libraries,"
that's true, "from statistics."
COLTON OGDEN: Oh, userman2 says
people often think it is User Name 2.
Yeah, no, I'm glad I
caught that correctly.
"From statistics import average."
OK.
So there is a module for
statistics import average.
VERONICA NUTTING: Yeah.
COLTON OGDEN: OK.
Yeah, the beautiful
thing about Python is
there's a library for
just about everything.
Honestly, it's great.
"Mean, not the average.
From statistic, import the mean."
Yeah, forgot about the mean.
Also, NumPy.mean.
VERONICA NUTTING: Yeah.
COLTON OGDEN: NumPy is a very
ubiquitous numerical library.
Very fast because it has a C
compiled binary that it references.
VERONICA NUTTING: Really?
Oh, that's cool.
COLTON OGDEN: It ties into it, yeah.
VERONICA NUTTING: Oh,
that's interesting.
COLTON OGDEN: "You can use a lambda
expression," says bhavik_knight.
I think he's referring to--
I'm not sure which
part he's referring to.
[INAUDIBLE] at Twitch,
"Twitch app is a bit buggy.
Couldn't connect to chat.
How are you all doing?"
We're doing fantastic.
VERONICA NUTTING: We are.
COLTON OGDEN: How about you?
How are you doing?
Thank you for joining us and
thank you for the follow.
Everyone else it looks like
is chiming in there, as well.
Yeah, bhavik_knight came in
there with the length for e
in first names, which we did.
"Props to you two for sticking
to naming conventions in Python."
Yes, very important.
Lowercase without camel case.
I got chewed out many years
ago in Stack Overflow.
VERONICA NUTTING: Really?
COLTON OGDEN: I went into
the Stack Overflow chat.
One of the people there was
like, I would never hire you.
Because I was using camel
case notation for variables
because I come from a Java background.
VERONICA NUTTING: OK.
Wait.
So camel case would be like--
COLTON OGDEN: Camel
case would be something
like if I were to say
my list, like that.
VERONICA NUTTING: So not the first one?
COLTON OGDEN: Exactly.
That is camel case.
And I got-- it is very non-standard
in Python to use camel case.
VERONICA NUTTING: Interesting.
COLTON OGDEN: You want to
use underscore notation
or lowercase and underscore notation.
I forget the name of it.
But I went to the Stack Overflow
chat and I was asking for help,
and one of the people in there, who was
a very prominent Stack Overflow Python
programmer, is like, just FYI, you
need to be using this notation.
And if I were to hire somebody and
see them using variables like this,
I would not hire you.
VERONICA NUTTING: That is tough to hear.
Wow.
COLTON OGDEN: I understand now.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Because all of the code--
VERONICA NUTTING: Readability.
COLTON OGDEN: It just
looks like amateur code
if you're using camel case coming
into it and asking questions.
VERONICA NUTTING: Interesting.
COLTON OGDEN: And if you look at the
corpus of Python code that exists,
it's not standard.
VERONICA NUTTING: And
it's called camel case?
COLTON OGDEN: Camel case
for the capital letters.
VERONICA NUTTING: Oh,
because it's a hump.
COLTON OGDEN: Yeah, exactly.
Exactly.
I forget what it's named--
I forget what the name
is for the notation
that Python typically encourages
you to use for variables.
But yeah, that was a good
learning experience for me.
VERONICA NUTTING: What do
you think about underscores?
COLTON OGDEN: I like
underscores in variable names.
I've gotten used to it because, for
example, it's common for variables
to have that notation, the
underscore between words.
But without it is fine, too.
You see it all in variable places.
As long as you don't
have capital letters.
That's--
VERONICA NUTTING: That's so interesting.
COLTON OGDEN: Capital letters should
only be used when you have a class
and you're defining a class and that's
the name of a class, capital letter.
VERONICA NUTTING: OK.
Do you have a rule of thumb for how long
or short you go with variable names?
COLTON OGDEN: I try to make
them not too obnoxiously long.
Because I don't want to have to
type them over and over again.
VERONICA NUTTING: Fair, yeah.
COLTON OGDEN: Namelengths is probably
one of the larger ones I would go for.
VERONICA NUTTING: I
wouldn't underscore this
just because I think that, to
me, looks way too long already.
COLTON OGDEN: Yeah.
It definitely makes it look much longer.
And it's hard-- you have to
go and type up the underscore.
Yeah, David in the chat says, "Correct.
Lower case with underscores."
VERONICA NUTTING: Is that--
COLTON OGDEN: The formal--
VERONICA NUTTING: Really?
COLTON OGDEN: No, it's not
the formal terminology.
But that is the expected
way at which to write
variable names in Python for just
variables that you would normally use.
Now, classes are different.
Classes expect capitalization
and then expect
camel case notation within those names,
unlike pretty much every other context
in Python.
VERONICA NUTTING: Interesting
that that's the convention.
Yeah.
And then I think the last thing,
I think one of my pet peeves
is single character variable names.
COLTON OGDEN: Yes.
VERONICA NUTTING: Even if you're
doing something where it's like--
even for stuff like files.
I'm not really a fan of f as
a variable name for anything,
except for as counters.
COLTON OGDEN: In a with
statement, you will often
see the with statement
used for file opening
with f, just as a common convention.
VERONICA NUTTING: Oh,
because if it's a block.
COLTON OGDEN: Yeah.
VERONICA NUTTING: So
you don't really need--
COLTON OGDEN: It get
thrown away at some point.
You don't really think about it.
But yeah, generally, single
character variable names
can be very easy to clobber each
other and just forget the semantics,
the meaning of them.
Like, what's s?
What's j?
What's l?
But yeah, if you're using a for loop or
a nested for loop, then it makes sense.
Because those variables,
you're not really
doing much with them--
a little bit sometimes.
VERONICA NUTTING: Local.
COLTON OGDEN: Yeah.
They're very isolated.
VERONICA NUTTING: I think you're right.
Yeah, I think that's a good rule
of thumb, iterators and anything
blocked out is maybe an OK idea to
do something shorter or less clear,
like a single character variable name.
Interesting.
COLTON OGDEN: Yeah.
"So many tutorials use camel case."
Oh, yeah.
It's a little painful when you get
used to Python's way of seeing it,
and in the context of Python.
Obviously, in the context of JavaScript
and in the context of C#, Java,
whatever, it's expected.
But in Python, it just
jars you a little bit.
Like, what am I looking at?
VERONICA NUTTING: Yeah,
no, that's interesting.
And I'm curious.
I'm sure it varies company by company,
but you think the convention of Python
is always just this.
Interesting.
COLTON OGDEN: 100%.
I learned the hard way.
People yelled at me on Stack Overflow.
But that's how you learn.
VERONICA NUTTING: Yeah.
COLTON OGDEN: "Bye, folks.
Dentist," says Brenda.
So thanks for joining us, Brenda.
VERONICA NUTTING: Bye, Brenda.
COLTON OGDEN: Happy to have you.
See you on the next stream.
VERONICA NUTTING: Dentist?
Oh, going to the dentist.
COLTON OGDEN: Yeah.
VERONICA NUTTING: Dentist?
COLTON OGDEN: I'd rather not
be in Brenda's shoes right now.
But [INAUDIBLE] says,
"Does f string have
the same speed as the percent sign?"
VERONICA NUTTING: Interesting.
COLTON OGDEN: That's a good question.
I'm not 100% sure.
I haven't looked into it.
I would imagine they probably both
use the same underlying algorithm.
It's just a different grammar.
And maybe they use a different
function underneath the hood.
I'm pretty sure f string just uses the
dot format function under the hood.
I don't think dot format
uses the same underlying--
because I think the percent
sign is just a c call.
The dot format function and the f string
probably have the same running time,
because I think they have almost
the exact same parameterization
capabilities, the template
parameterization, where
you say 0.2 f within the
template to specify the format.
But I don't know.
Good question.
I would be curious to
see the running time.
VERONICA NUTTING: Lots of great
questions about Python efficiency,
especially with different versions.
COLTON OGDEN: It's important,
I think, because Python,
it's used a lot in big data sets.
VERONICA NUTTING: Yeah.
And it's not like--
I think there are some
languages where there's
one version that's now
become the accepted default.
But Python 2 is still
very much used online.
COLTON OGDEN: Yeah, no, a
lot of Python 2 legacy code.
Even I was reluctant
to switch to Python 3.
Yeah.
For the longest time, I was being told--
Python 3 has been out since 2008.
But I was not-- and I
started with Python 2.7
and it was hard for
me to go two Python 3
just because there's a lot
of differences in Python 2
versus Python 3.
Big among them-- the obvious one
would be the print statement.
It's no longer valid.
It doesn't work.
So you have to completely change
all of your code with print.
But there's a lot more than that.
But that's one of the more
apparent, visible things.
VERONICA NUTTING: That's interesting.
And I'm sure when you're
designing a new version,
there are all these really
interesting conversations,
I'm sure, happening in
some room about, what
functionality do we leave as a middle--
like a bridge.
Do you know what I mean?
Because we looked at one
way to format strings
that works in both versions,
which is interesting.
So to what extent are you going to
force people to just change and learn
the new language and
learn the new version?
And to what extent are you going to
accept that that transition is probably
going to take time and should probably
leave some functionality there
to make it as smooth as possible?
COLTON OGDEN: It looks like
userman2, to that point,
says, "Python 2 is being
deprecated in 2020."
So in 2020--
VERONICA NUTTING: Wow.
COLTON OGDEN: --any companies
using Python 2 are SOL.
VERONICA NUTTING: Interesting.
COLTON OGDEN: "Snake case," says Andre.
I guess snake case, yeah.
VERONICA NUTTING: Snake case?
What's snake case?
COLTON OGDEN: Underscore
with lowercase letters.
VERONICA NUTTING: Oh, is
that what it's called?
COLTON OGDEN: Yeah.
I think David actually mentioned
that recently in one of his streams.
VERONICA NUTTING: Really?
Oh, my goodness.
OK.
Snake case-- that's a
pretty cool convention name.
Wow.
That's pretty cool.
COLTON OGDEN: And it
works with Python, too.
VERONICA NUTTING: Yeah.
I like snakes.
COLTON OGDEN: "I prefer first
name in general when I'm on PC,"
says bhavik_knight.
Oh, bhavik_knight is typing
and he's having a hard time
typing the variable names with
underscores, because he's on his phone
because the electricity
went out where he's living.
VERONICA NUTTING: Oh, yep.
COLTON OGDEN: "Capital letters starting
with the first letter being capital
is pulled Pascal case," says userman2.
I'm guessing that's referring to
Pascal the language, although I'm not
100% sure if that just is
another reference to Pascal the--
was he a philosopher?
A mathematician?
I forget exactly what he was.
"Screaming snake case," User Man 2.
Yeah, constant notation in C, when we
have the hash to find some constant.
VERONICA NUTTING: Yeah, yeah.
COLTON OGDEN: That would be--
or you'd use the const
keyword, for example.
VERONICA NUTTING: Is that
called screaming snake case?
COLTON OGDEN: It's not called--
I don't think it's called
screaming snake case.
No.
I don't know what it's
called, but it's--
VERONICA NUTTING: Yeah, like when
we're defining global constants
at the beginning of
a C program, we'll do
hashtag define alphabet length in all
caps or something shorter than that,
and then you'd put space 26.
And then you could just use all
caps, alphabet length, in your code.
And your compiler would actually
just directly replace anywhere
that it sees all caps alphabet length
with 26 before even running it,
which is great.
It makes the program more readable.
And it's also-- it's just great because
anytime you can let your compiler
know that you're not going
to be making changes,
as by referring to
something as constant,
you're giving it a little bit
more agency with how to manipulate
what's going on underneath the hood.
Because it can make a
bunch of design decisions
that are catered to
efficiency two steps ahead.
Like, again, replacing alphabet
length everywhere with a 26
just directly, which is good, yeah.
COLTON OGDEN: Makes sense, yeah.
[INAUDIBLE] 2.7.
VERONICA NUTTING: Oh, that's so cool.
Wow.
OK.
COLTON OGDEN: Where?
VERONICA NUTTING: This.
COLTON OGDEN: Oh, yeah.
"The f string in 2.7, faster
than percents, from my testing."
Yeah, they do a lot of efficiency-- they
upgraded the dictionary access speed
by quite a bit, between 3.6.something
and 3.6.something-- like,
3.6.5 to 3.6.6, they changed
the dictionary algorithm--
they're hashing algorithm
in their dictionary, which
increased their efficiency quite a lot.
VERONICA NUTTING: By how much?
COLTON OGDEN: I don't
remember the percentage.
It was meaningful.
VERONICA NUTTING: OK.
COLTON OGDEN: It was
like 40% or something.
VERONICA NUTTING: Wow.
That is so meaningful.
Wow.
OK.
COLTON OGDEN: Everything in Python
pretty much is the dictionary.
Like, I think sets are dictionaries,
classes are dictionaries.
VERONICA NUTTING: Like,
underneath the hood?
COLTON OGDEN: Yeah.
And the dictionaries,
obviously, are dictionaries.
So much of the language
is built on that.
40% or whatever the percentage
was, it was meaningful.
It wasn't like 4%.
It was a sizable increase.
It was actually quite impressive.
And it's great that they're
keeping all this into consideration
as they keep going.
VERONICA NUTTING: Well, I liked
your comment of dictionaries
are dictionaries.
COLTON OGDEN: Yeah.
VERONICA NUTTING: If you take
away anything from today--
COLTON OGDEN: Yeah, a
very meaningful statement.
VERONICA NUTTING:
Dictionaries are dictionaries.
COLTON OGDEN: Yeah.
Nicholai is going to
keep trying for that.
I don't know if we can
humor that one, Nicholai.
We appreciate your
enthusiasm about it, though.
[INAUDIBLE] says, "F stream
should be the fastest now,
according to the tests that I've seen."
Yeah, which is great.
Because f strings, them
being the most readable
and the fact that
they're putting the most
work into making them most efficient,
I feel like that's a really cool thing.
VERONICA NUTTING: That
makes sense, yeah.
And I think the evolution
of computer science language
is actually really, really fascinating.
Not necessarily like culture, but
how we start to use the language
changes how we make it better.
So there's this really,
really cool thing about--
and I think it's wonderful that
programming languages evolve
and that there such a clear feedback
loop where people are programming
and then they're like,
this could be better.
And then someone's like,
I'll make it better.
Awesome.
Yeah.
I'm going to change it.
Here's the new version, it's better.
And then everyone gets
together and maybe
have a convention on
how to improve Python.
But I think that's a really great thing.
COLTON OGDEN: And so many
people are so opinionated, too,
which is another thing.
Not every language can
please every person.
VERONICA NUTTING: For sure.
And I think with every change
that you make to a language,
you're going to be
causing a bit of a ruckus.
But I think it brings up all these
really interesting trade offs.
And there's so much room for debate.
With a lot of my CS friends,
we are constantly debating--
not like-- OK.
So there are a couple
of design questions
that can be easily quantifiable, right?
Something can be faster, something
can take up less memory, et cetera.
But then there are some that are
a little bit more qualitative,
a little bit less clearly measured.
And then that's where I think you really
can make and lose friends when you're
fighting about some of these things.
So I think looking at different
versions of programming languages
and looking at how they've changed
is a really, really cool thing.
COLTON OGDEN: Yeah, I had to work hard
to get David to embrace f strings,
I'm telling you.
VERONICA NUTTING: Really?
COLTON OGDEN: Yeah, had to work hard.
But it paid off.
CS50 teaches f strings now.
VERONICA NUTTING: Yeah.
Oh, wow.
COLTON OGDEN: And uses 3.6.
VERONICA NUTTING: Yeah, I
guess last year we didn't.
COLTON OGDEN: Yeah.
VERONICA NUTTING: That's-- oh, wow.
COLTON OGDEN: I think we did
teach f strings last year.
VERONICA NUTTING: Did we?
COLTON OGDEN: I think we did.
I think it was 2016 where
we didn't teach f strings.
I could be misremembering.
VERONICA NUTTING: I don't remember.
COLTON OGDEN: I could be misremembering.
If David's still in the chat,
he's the source of truth on that.
VERONICA NUTTING: Yeah.
So it's being deprecated.
COLTON OGDEN: "Too bad it's
still standard in all--"
oh, 2.7 is saying, "It's
too bad 2.7 Python is still
standard in all Linux repositories."
That's an interesting decision.
Oh, "Some Linux distros
that are updated use 3.6."
Yeah, I would imagine that that would be
something that they should preemptively
do, especially if it was
going to be deprecated,
unless it's an older distro.
VERONICA NUTTING: What does it mean
for a previous version of a language
to be deprecated?
Does that just mean you can't down--
because you still have it.
COLTON OGDEN: They'll stop updating it.
They'd probably take the
documentation off of their front page
or at least put it
into a legacy website.
They'll also, maybe, not
provide formal support for it
or maybe just start not
really talking about it.
VERONICA NUTTING: Maybe
putting money into it.
OK.
COLTON OGDEN: I think it's a loose
term that different companies will
treat in different ways.
Because a lot of deprecated stuff still
gets support many years down the road.
VERONICA NUTTING: Yeah.
That's interesting.
COLTON OGDEN: I don't know.
"Time to use Windows
10," says [INAUDIBLE]..
Yeah.
VERONICA NUTTING: Why?
COLTON OGDEN: Instead of Linux.
VERONICA NUTTING: Oh, yeah.
COLTON OGDEN: Yeah.
What is he responding to--
Python [INAUDIBLE].
"Reply to the Twitch chat,
please," says [INAUDIBLE] 1997.
VERONICA NUTTING: We're replying.
COLTON OGDEN: Oh, yeah.
Doing our best.
There's a lot.
There's so much of it-- so much of it.
Also, talking and teaching so
that you two balance it out.
[INAUDIBLE],, did I miss
a comment that you said?
Is that why you're saying that?
I apologize if I missed that.
I don't see one up there.
Maybe they're just talking about--
VERONICA NUTTING: Feel free to
put that comment in again, though.
COLTON OGDEN: "Kind of hard
to find the proper balance.
Give him some slack."
It's a lot of--
I honestly enjoy the discussion--
the black and forth discussion a lot.
And I feel bad when I don't
have time to read everything.
But I also feel bad when we don't
have enough time to teach the concept.
Because I feel like that's essentially
why a lot of people are here,
they want to learn the content.
So a nice 50/50-- the
ideal 50/50 would be nice.
VERONICA NUTTING: Yeah.
COLTON OGDEN: I don't know.
It's hard to--
VERONICA NUTTING: "Can you
make the lines wrap around?"
COLTON OGDEN: "--the lines wrapped
around?" says Recursive Chat.
By the way, thanks for joining.
I don't recognize the username.
I do recognize Code Error,
who rated us last time.
So thank you, Code Error, for being a
part of that and thank you for rating.
VERONICA NUTTING: Rating positively or--
COLTON OGDEN: Rating means that they
bring their chat into our channel.
So on their channel-- they
have their own channel.
VERONICA NUTTING: Yeah.
COLTON OGDEN: They take
their people in their chat
and they bring them into our chat.
VERONICA NUTTING: Oh,
wait, that's so cool.
COLTON OGDEN: Yeah.
VERONICA NUTTING: Oh, which
is why we have the little--
COLTON OGDEN: I'm not sure.
I think that just means that
they have a Twitch something--
not Twitch Prime.
Twitch Prime has a different icon.
It's something else.
Twitch Prime has the
purple one, I think.
VERONICA NUTTING: I'm not sure
what Recursive Chat means by,
"Can you make the lines--"
COLTON OGDEN: Oh, in your text editor.
I think you can.
I think it's in your view settings.
I'm not entirely sure of Atom offhand.
VERONICA NUTTING:
Yeah, no, I'm not sure.
COLTON OGDEN: Oh, toggle soft wrap.
Try that.
And now go back to the other tab.
That didn't work.
Oh, because for each--
maybe it's for each page.
Try going back in and doing it again.
Go to View, Toggle Soft Wrap.
There we go.
VERONICA NUTTING: Oh.
COLTON OGDEN: Yeah.
So it's a little bit weird, though,
because it doesn't indent it.
So it looks ugly, in my opinion.
VERONICA NUTTING: Yeah.
See, I would argue that's less readable.
COLTON OGDEN: Yeah, it is less readable.
You could do Command minus
and then maybe shrink it.
Maybe that would work.
We could see more of it.
Yeah, something like that.
Looks like it's reverting.
Oh, there we go.
Perfect.
VERONICA NUTTING: It's freaking out.
COLTON OGDEN: That looks good.
That looks great.
And then still, I think, perfectly
readable on the channel, as well.
VERONICA NUTTING: Oh,
I think it depends.
If you're on your phone,
it's probably a little small.
COLTON OGDEN: Oh, "It is
Twitch Prime," says Code Error.
Thank you.
I'm still very new to
the Twitch landscape.
I've been a passive
viewer of Twitch channels,
but not actually engaged
with it directly a whole lot.
"Try the example of sorting by
elements in a list or tuples,"
says bhavik_knight.
VERONICA NUTTING: Yeah, sure.
We can do that.
So let's go back to our--
OK.
So how about we do this?
We could recast our set of first
names as a list and then order that--
sort that.
COLTON OGDEN: Yep.
VERONICA NUTTING: Again, remember, the
reason we can't directly sort our set
is that sets are inherently unordered.
So there's no sense of
ordering, if that makes sense.
Cool.
Wow.
OK.
We really have been
going on for a while.
COLTON OGDEN: Yeah, we're at
two hours 48 minutes right now.
We typically-- I don't know
what time you want to adjourn.
We can go for until whatever other
examples you have set up, maybe,
and then take questions.
And then we'll do a part two.
VERONICA NUTTING: Yeah, sounds good.
OK.
Let me go ahead and print.
I think I can do--
sort.
Oh, OK.
No, actually, I'm going to do--
because this will directly sort it.
It's not producing a copy.
And then I can go ahead and print that.
OK.
So what I've done right
now is I said, hey,
please just create a list of the
set that we have with first names.
And the reason I'm looking at the set
is that the list of all the first names
isn't really that important,
except when we're doing the stuff
we did before, like averages and number
of presidents that have this name.
So now we can just do recasting
that set of first names as a list.
And then I'm going to say,
hey, calling the sort method.
And the sort method will sort
the actual elements of the list.
So it's not generating
a copy or anything.
It's directly sorting them, which is
why I can just directly print it here.
So let's go ahead and--
COLTON OGDEN: Nice.
And it did sort them by the
letter of their first name.
That's really cool.
VERONICA NUTTING: I forget--
I think there's a way
to sort like Z to A.
COLTON OGDEN: I think you
would have to pass in a lambda.
I think you would say
lambda x and then--
what is it?
I forget the exact--
Python sort backwards.
The old Google.
Oh.
Is it reverse?
Oh, yeah, no.
You would just say--
oh, no.
You have to define a function.
VERONICA NUTTING: OK.
COLTON OGDEN: Oh, wait, no.
Oh, this is for dates.
This is for dates.
In place sorting would
be reverse equals true.
VERONICA NUTTING: Oh, interesting.
OK.
COLTON OGDEN: Just type
reverse equals true.
VERONICA NUTTING: Oh, interesting.
Do you write your trues--
COLTON OGDEN: You can't
write them lowercase.
VERONICA NUTTING: I was going to say,
I have to write uppercase, right?
COLTON OGDEN: Yeah.
And then that should work.
Boom.
VERONICA NUTTING: Interesting.
COLTON OGDEN: Now, if you have a
more complicated sort that you want,
you can pass in a lambda function.
And so that's what an
anonymous function-- well,
it's not a lambda function
because you have to define it.
You have to use the lambda
keyword, though, to reference it.
Oh, sorry.
No, you just have to pass a key to
that's a reference to a function.
There's an example on Stack Overflow
about sorting a list in descending
order, if anybody wants to look at it.
But if you wanted to do it on one line,
you basically use a lambda function.
If you want to do it on as many
lines as you possibly want and you
want to make it a little bit easier to
read, you can just define a function,
pass that function as
the key to the sort
function, and it will take that
function and apply it to the data
and use that as the filter,
basically-- or not the filter.
But they'll use it as the sorting logic.
VERONICA NUTTING: That
makes sense, yeah.
COLTON OGDEN: Yeah.
VERONICA NUTTING: OK.
I think I would love to take questions
because I think at some point,
I have to--
COLTON OGDEN: Oh, that's true.
VERONICA NUTTING: --head
out to office hours.
COLTON OGDEN: You've got office hours
and classes and stuff like that.
VERONICA NUTTING: I do have
office hours and classes.
COLTON OGDEN: Let's finish
looking through the chat here.
Oh, Brian's in the chat.
VERONICA NUTTING: Brian!
COLTON OGDEN: In CS50 2016,
we taught Python strings
with the dot format method.
VERONICA NUTTING: Yay!
COLTON OGDEN: I do remember that.
And correct me, Brian, if I'm
wrong, but I thought last year,
2017, we used f strings
for the first time.
I could be mistaken, but I'm
pretty sure we used f strings.
User Man 2 says, "Deprecated
is no more updates.
It's frozen in time, never
to be touched again."
Oh.
VERONICA NUTTING: What is it?
Oh, "Deprecated is no more updates."
Wow.
COLTON OGDEN: That's cold.
That's cold.
I imagine the no more updates--
oh, it looks like--
sorry, I'm a little bit behind the chat.
But David, at the very bottom, is
saying, "Correct, 2017 was when
we used f strings for the first time."
David also posted a link in reference to
what somebody else said about Node JS.
So User Man 2 says, "Funny
story about deprecation I heard.
A lot of Node JS projects, I think,
relied on a string padding function.
This function was removed and it
caused a lot of errors and crashes
in quite a lot of business software."
VERONICA NUTTING: Wait.
That's so interesting.
COLTON OGDEN: I feel like
that's so dangerous to do.
VERONICA NUTTING: So I also
think with deprecation,
there's all this really
interesting stuff of,
like, how does one tell people
something is getting deprecated?
Do you you know what I mean?
How far in advance--
what's the right time frame for that?
What's the right timeline?
How many months or years
are companies going
to need if they're going to switch
from one version to another?
That is-- thanks for sharing that.
That's exciting.
COLTON OGDEN: I feel like when I
usually see deprecation warnings is
in code when I'm writing it.
And I compile it, and
then it's like, warning,
this function is going to be deprecated
in x, or, this function is deprecated,
try to start using this other function.
VERONICA NUTTING: Wow.
OK.
COLTON OGDEN: So I don't know.
I think they-- it's a hard
thing to do, I would imagine.
Like, getting people--
saying, hey, everybody,
all the people that are coding this,
you're going to get rid of the way
that you've been doing
things and do this new thing.
And you don't have a choice if
you want to keep continuing.
So sucks, but--
[INAUDIBLE], "Readable on the phone."
Oh, referring to your source code.
So that's great.
So if it's readable on mobile,
it's readable anywhere.
VERONICA NUTTING: Good.
COLTON OGDEN: Oh, and then
bhavik_knight provided a dictionary--
VERONICA NUTTING: More stuff, yeah.
COLTON OGDEN: Age.
Yeah.
OK.
That's a great example.
That was a loud, that crack.
I heard that neck crack--
felt it.
"Key functions [INAUDIBLE]
reverse equals true."
Yep, correct.
VERONICA NUTTING: What's that?
Oh, slicing.
COLTON OGDEN: Yeah, slicing.
I forget what the doubles--
VERONICA NUTTING: What's the negative?
COLTON OGDEN: I forget
what that is offhand.
I used that in a script not long ago.
VERONICA NUTTING: Really?
OK.
COLTON OGDEN: What was it?
Python slice double colon.
And what is double colon in
Python when subscripting?
VERONICA NUTTING: Stack Overflow.
COLTON OGDEN: It means nothing for the
first argument, nothing for the second.
Jump by-- oh, the jump by amount.
VERONICA NUTTING: Interesting.
COLTON OGDEN: So if you want to iterate
backwards through something, yeah,
you would-- because you
can specify a jump amount.
So you can--
VERONICA NUTTING: You can say negative.
OK.
COLTON OGDEN: Yeah.
So by negative one means it will
start and work your way backwards.
VERONICA NUTTING: Fascinating.
COLTON OGDEN: Yeah, it's super cool.
Yeah, that's right, I did see that.
VERONICA NUTTING: userman2
saying true is equal to true.
I don't know if that will work.
COLTON OGDEN: Say what again?
VERONICA NUTTING: Someone's saying--
COLTON OGDEN: Oh, no.
User Man 2 is giving you the
kappa instead of the sarcasm.
So he's basically saying,
true is equal to true.
Which normally would be the case.
But Python is case sensitive when
it applies to the true literal.
VERONICA NUTTING: OK.
COLTON OGDEN: So you
can actually do that.
VERONICA NUTTING: So
this little one is--
COLTON OGDEN: It's sarcasm.
Yeah.
VERONICA NUTTING: Is this sarcasm?
COLTON OGDEN: It's called kappa.
Yeah, it's a twitch meme.
One of the founders of Twitch,
or Justin.tv-- that's his face.
VERONICA NUTTING: That's fun.
COLTON OGDEN: Yeah.
It's pretty-- you see
it all over the place.
Another one right here.
"The wonderful world
of business software
where nothing can be updated
because of dependencies."
VERONICA NUTTING: OK.
So dependencies, like depending on--
COLTON OGDEN: Legacy software, yeah.
VERONICA NUTTING: Oh.
Interesting.
COLTON OGDEN: Having
your project setup-- so
say you rely on version 3.1.10 of some
library, 2.6.5 of some other library.
And if any of them change and
they have deprecated functions,
you're screwed because you don't have
access to those functions anymore.
VERONICA NUTTING: That
is so interesting.
COLTON OGDEN: I've seen
it in some Node projects.
There were a lot of specific-- a
specific library of a specific version,
and they'll change it.
And then, yeah, you try to NPM
install if you've gotten a bunch of--
let's say maybe you've updated
those libraries or something
and you try to NPM install.
It just says broken.
So you've got to go in and fix it
or change whatever is wrong with it.
It's not the greatest experience.
So you have to stay very
strictly to those versions.
VERONICA NUTTING: I almost
feel like it's a legal issue.
If I were a big company using some
version of a programming language,
I think I'd want some sort
of legally enforced warning.
COLTON OGDEN: I think a
lot of these libraries--
I think that's why they have--
VERONICA NUTTING: Can you sue?
COLTON OGDEN: I think that's why they
have these license terms that say,
this software is provided
as is without a warranty.
Any damage that gets incurred is on
behalf of the user, not the library
provider, for that reason.
VERONICA NUTTING: Yeah, no.
COLTON OGDEN: For that exact reason.
VERONICA NUTTING: I can really
imagine myself just suing.
COLTON OGDEN: And User Man 2 says,
"Start, stop, and the step amount is--"
VERONICA NUTTING: Oh, OK.
Awesome.
COLTON OGDEN: OK.
"I'm leaving.
Work day is done," Stay Peaceful 89.
Thanks for joining us.
Next stream is tomorrow
with The Master Jedi,
The Dark Lord himself, David
J. Malan, Regular Expressions.
Come and join us.
That's going to be a fantastic stream.
VERONICA NUTTING: What time is that?
COLTON OGDEN: That one's going
to be at 3:00 PM tomorrow,
Eastern Standard Time.
A little later than the streams
that David and I usually do.
We usually do it at 1:00.
But I think tomorrow--
VERONICA NUTTING: 1:00 is a good time.
COLTON OGDEN: Yeah.
1:00 is a good time because we
get more reach abroad, typically.
VERONICA NUTTING:
Because of the time zone.
COLTON OGDEN: Some folks, for
them, it's 2:00 or 3:00 AM.
I think even some of the people
that are in the chat right now--
VERONICA NUTTING: Wait.
I was about to say, I wonder
what is the ideal time.
COLTON OGDEN: Its hard because
no matter what time you choose,
it's going to be 2:00 AM somewhere.
VERONICA NUTTING: No, but
what an interesting question.
If you look at what time would you--
like, what hour will maximize the
number of people that can watch?
COLTON OGDEN: Oh, yeah.
There is an ideal time for an audience.
VERONICA NUTTING: Like, worldwide?
COLTON OGDEN: I don't know.
That's a good question.
You'd have to--
VERONICA NUTTING: Is it 8:00
AM Eastern Standard Time?
I have no idea.
COLTON OGDEN: Probably
something like that, yeah.
Because we do have a large
international audience.
VERONICA NUTTING: Yeah.
COLTON OGDEN: I feel like it's
probably something like that, yeah.
VERONICA NUTTING: That
is so interesting.
Wow.
OK.
COLTON OGDEN: Oh, User Man 2,
"Setting a variable called true
and setting it to true."
That's a good point.
You could do that.
VERONICA NUTTING: Oh, that's funny.
COLTON OGDEN: I like that.
I do like that.
D28H, "Love that joke."
"Is function overloading possible?
Is there a workaround?"
VERONICA NUTTING: What's
function overloading?
COLTON OGDEN: So defining a function
and then overloading the function
or calling a function with
multiple signatures, I'm guessing.
VERONICA NUTTING: Oh, OK.
COLTON OGDEN: So you can call
functions with variable signatures
and that shouldn't throw an error.
If you redefine a function--
and we can test it real quick.
So if I go to--
and they're not seeing
it on my chat, but we
can replicate this and figure it out.
So I'm-- def foo x pass, def foo y pass.
Did I-- oh, no.
I did something wrong.
Sorry.
def foo pass.
VERONICA NUTTING: Oh, I see.
COLTON OGDEN: And then def foo y pass.
Oh, yeah.
You can overload it.
So you can just redefine it and
it'll overwrite the prior function
definition.
Thanks for the question,
[INAUDIBLE] 1997.
You can use-- yeah, you can unpack
arguments and use keyword arguments
and do checks.
Yeah, that's the more flexible version.
You typically would not want
to overwrite a function.
I guess overload--
overload is usually applied
to operators in a language like C.
VERONICA NUTTING: OK.
COLTON OGDEN: You can do
it in Python, I think.
I'm not 100% sure.
VERONICA NUTTING: Oh, OK.
COLTON OGDEN: I think you can
define, like, what plus does.
VERONICA NUTTING: Really?
COLTON OGDEN: Because list--
for example, you can add
lists together, for example,
and that has specific behavior.
But--
VERONICA NUTTING: So you're saying--
OK.
OK.
That's interesting.
COLTON OGDEN: That's
called operator overload.
That's something you see a lot in C++.
That's one of the big paradigms.
It's a little bit awkward to use.
And David J. Malan
with the smiley there.
VERONICA NUTTING: I don't know--
oh, the robot.
COLTON OGDEN: He doesn't like what
I said about our stream tomorrow.
It's going to be a great stream, though.
Tune in for that.
VERONICA NUTTING: Wait.
Why doesn't he like what
you said about your stream?
COLTON OGDEN: I think The
Dark Lord message that I--
VERONICA NUTTING: I really think it's--
yeah, I think he has such a fan base.
COLTON OGDEN: Yep, he does.
He definitely does.
A very enthusiastic fan base
with the Star Wars references.
VERONICA NUTTING: Oh,
Brian is also in the chat.
COLTON OGDEN: Yeah.
Everyone's excited to see Brian.
Brian might have stepped
out, though, because he
didn't comment after that other one.
VERONICA NUTTING: But he was here.
COLTON OGDEN: Maybe
because David clarified.
"If length of r is equal to 2,
two parameter version--" oh, yeah.
You could defer your function
call to other sub functions.
You can actually define
them within the function
after you call the regular
function, the main function itself.
And then just call different functions
depending on how many arguments
they entered into the signature.
VERONICA NUTTING: Interesting.
COLTON OGDEN: "Different names
for the user to choose from."
Yep.
Yeah, Brian's there.
Nice.
"To be honest, [INAUDIBLE] keyword
architecture becomes hard to maintain.
Especially if there's a lot
of variance and documentation,
it's hard to keep updated
for the main function."
Yeah, I can see that getting very messy.
VERONICA NUTTING: Interesting.
Yeah.
COLTON OGDEN: I feel like I've
seen that in libraries, though,
where they do have a lot of
that flexible argument checking.
Just because I almost feel
like it'd be better style
to write smaller functions,
just classic modular design.
VERONICA NUTTING: Yeah.
COLTON OGDEN: But I don't know.
I think it varies on that library or--
VERONICA NUTTING: I think it errs on
the side of smaller functions, as well.
COLTON OGDEN: Yeah.
Smaller functions is a
universal recommendation.
But it's one of those things that's
easy to suggest and do and think about,
but hard necessarily
to always implement,
depending on the
complexity of your logic.
VERONICA NUTTING: Yeah, I've had a
couple situations recently where I've
been coding within one function.
And then I just--
I keep thinking, oh, should I break
this out into another function?
And I'm like-- and there's a couple easy
things, like, will I use this again?
And then sometimes you're like, yes.
OK, let's break it out
into another function.
But then sometimes you're like,
I'm only going to use this once,
but it might be clear if I
were in a different function.
But then maybe it's going to
be a few extra lines of code.
So I don't know.
These are always interesting
things that keep me up at night.
COLTON OGDEN: Sometimes
you're just like,
do I want to go through the
effort of doing it, too?
And it can be hard.
And then there's the natural
feature creep of scripts
that you've written, too.
If you had to go back to it over and
over and over again and add new stuff,
sometimes you're just like, I
just want to finish writing it
and just add more stuff to it.
I'm not going to modularize it.
And then you regret it later
when you have to do it again.
VERONICA NUTTING: Yes.
COLTON OGDEN: And your
script is gargantuan.
VERONICA NUTTING: Yeah.
Gargantuan.
How do you spell that?
COLTON OGDEN: G-A-R-G-A-N-T-U-A-N.
VERONICA NUTTING: Gar--
COLTON OGDEN: Gar-gan-tu-an.
U-A-N. Yeah, just like that.
VERONICA NUTTING: I don't even know why.
COLTON OGDEN: There's a lot
of that string multiplication.
[LAUGHING]
VERONICA NUTTING: I really got
into the string multiplication.
COLTON OGDEN: You got to automate
that string concatenation.
VERONICA NUTTING: Yeah, I
just thought it was so fun.
COLTON OGDEN: "Veronica, you
have great support," says Fatma.
VERONICA NUTTING: I do, yeah.
COLTON OGDEN: David Sir is Master Yoda.
VERONICA NUTTING: Oh, wait.
That's Yoda, so different.
COLTON OGDEN: Yoda is different than
The Dark Lord versus The-- yeah,
he's gone from Master
Jedi to Dark Lord to--
VERONICA NUTTING: Master Yoda is--
COLTON OGDEN: Way down to Master Yoda.
VERONICA NUTTING: Isn't Master
Jedi the same thing as Master Yoda?
COLTON OGDEN: No, because
Yoda's the green guy.
VERONICA NUTTING: Is he not a Jedi?
COLTON OGDEN: He is a Jedi.
VERONICA NUTTING:
Isn't he the main Jedi?
COLTON OGDEN: I don't know if he--
VERONICA NUTTING: The Jedi master.
Is he the master?
COLTON OGDEN: He's the Jedi mentor--
kind of.
It depends on which
episode you're looking at.
VERONICA NUTTING: Yeah, sure.
COLTON OGDEN: But yeah.
"A common workaround for
alternate constructors
is having the main take
the base stuff, then
have class dot from user
user, which extracts the info
and calls the main init."
Let me read that one more time.
"A common workaround for
alternate constructors
is having main take the based
stuff--" not sure what that means,
"the base stuff."
The arguments from the--
if you have a main class
and you take arguments
in the constructor.
''--have class dot from user user, which
extracts the info and calls the main
init."
I guess, like, filtering
the data before you
call your init function on the
constructor, if that's what you mean.
Like, in the meta class or
in the actual class itself.
I'm not sure.
"Yoda is a master Jedi, I
think," says User Man 2.
I think he is as well.
VERONICA NUTTING: Good.
COLTON OGDEN: I think Jedi
is just a class of stuff.
VERONICA NUTTING: A class.
COLTON OGDEN: Yeah.
Ah, there we go.
Another class.
And then President of Mars--
I'm not sure what that--
VERONICA NUTTING: Aw,
I think it's a sad--
COLTON OGDEN: Sad because
I think pretty soon, we're
going to wrap this stream up,
actually, because you have to head out.
VERONICA NUTTING: I do.
I have class.
I don't have class, I have office hours.
COLTON OGDEN: Oh.
What office hours?
VERONICA NUTTING: For
systems programming.
COLTON OGDEN: Oh, OK.
Where's that being held at?
VERONICA NUTTING: Maxwell-Dworkin.
COLTON OGDEN: Oh, OK.
VERONICA NUTTING: I have
a bike, but it's raining.
COLTON OGDEN: Is that where
most of the CS courses are?
VERONICA NUTTING: Yep.
I spend so much time there.
Mather and Maxwell-Dworkin is quite far.
COLTON OGDEN: Oh, we have a question
for Brian in the chat, actually.
VERONICA NUTTING: Oh!
COLTON OGDEN: By the way,
if anybody is tuning in
and hasn't seen the stream with
Brian where we talk about React,
it's a great stream.
Check it out.
It's on YouTube and it's on Twitch VOD.
But it's probably going to
be taken off at some point.
On Twitch, we have a 60-day
period where our videos are up.
But on YouTube-- if you're
watching on YouTube--
VERONICA NUTTING: It's persistent.
COLTON OGDEN: Yeah.
Forever and ever.
The React stream, it's awesome.
Awesome intro to React.
[INAUDIBLE], "[INAUDIBLE] is optional.
So if I make a GitHub repo to push code,
wouldn't it be against the honor code?
Because repos are, by default, public."
That's a good question.
"User init name or age, then user from
dict info, user dot init dict name.
Cut it short, but you
still get the point."
I think I get an example of
what you're talking about,
just deferring, depending on the
input, what the constructor does.
Basically alternate constructors.
Yeah, I think I understand
where you're coming from.
All right.
We'll take some last questions for
maybe another five or so minutes,
and then we'll wrap up.
And then we'll do another part.
I don't know how many
things we covered today.
We covered a lot.
There were maybe 10 big topics.
But then within each
of those, we probably
touched on five or six
different smaller things.
So we've probably covered
30 or 40 different things.
VERONICA NUTTING: That
being said, I think this is
going to have to be a 80-part series.
No, I'm just kidding.
COLTON OGDEN: Oh, you are going to
go-- we're going to go full 100.
OK.
VERONICA NUTTING: Well, I like setting
high goals and trying to meet them.
COLTON OGDEN: Respect.
Yeah, no, I think everyone
wants to see 100 stuff--
100 things.
We definitely got a lot.
We covered a lot.
We covered, like, 40--
I would say 40 different little--
VERONICA NUTTING: But I also
think a bunch of Python stuff
intermixed with some
interesting, random life things.
COLTON OGDEN: Systems
stuff, which is very--
VERONICA NUTTING: But also
other bigger picture CS stuff.
It's not all about just the coding.
A lot of it's problem solving and
legal stuff and culture and design.
COLTON OGDEN: And Russian literature.
VERONICA NUTTING: And
Russian literature.
Pushkin, Gogol.
COLTON OGDEN: This is a web
of stuff all tied together.
VERONICA NUTTING: It's all alive.
COLTON OGDEN: Oh, man.
Yeah, Brian [INAUDIBLE] responded.
VERONICA NUTTING: Awesome.
Great.
COLTON OGDEN: "--push
code to GitHub repo,
as long as the work you
submitted is your own."
Thank you very much.
Thank you so much.
"Wow, Colton, you're
doing a great job hosting.
This is fun."
VERONICA NUTTING: Aw, yes!
COLTON OGDEN: Thank you very much.
Very much appreciated.
Thank you for tuning in.
You've tuned in multiple times.
I'm glad to have you with us.
President--
VERONICA NUTTING: Oh, it's astonished.
Oh, that's good.
COLTON OGDEN: Oh.
OK.
VERONICA NUTTING: I was so
worried that it was, like--
oh, sorry.
I hit my mic.
I'm so sorry.
I thought it was, like, I'm devastated.
COLTON OGDEN: And it's
from the BTTV extension.
So we actually can't see it.
We don't have the BTTV extension
enabled, but if we did,
we would see some custom
emoji, which is cool.
VERONICA NUTTING: Oh, I see.
COLTON OGDEN: "An example of
alternative functions, if needed."
VERONICA NUTTING: Good.
COLTON OGDEN: Oh, it's in Ruby, as well.
OK.
VERONICA NUTTING: Oh, that's cool.
Oh, yeah.
That's helpful.
COLTON OGDEN: Interesting.
Oh, it's not in-- is it in Ruby?
It looks like Python.
VERONICA NUTTING: I was going to
say, it does look like Python,
but it's got the--
COLTON OGDEN: It's dot RB.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Oh, unless
it's being served--
no, it wouldn't-- why
would it be served from RB?
I'm not sure.
Oh.
It's-- OK.
I see.
So from dict, and then CLS is the
class type for the constructor.
And then it's passing
in the information.
OK.
That makes sense.
OK.
VERONICA NUTTING: Interesting.
OK.
So you can click on that link.
COLTON OGDEN: It's something that--
it looks like library type code.
I don't do a lot of library editing in--
VERONICA NUTTING: Oh, look.
We do have some Russian literature!
Look at that!
COLTON OGDEN: Oh, nice.
Steve [INAUDIBLE].
By the way, thank you for joining us.
I think this is the first
time we've seen your name.
Anna Karenina.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Have you read that?
VERONICA NUTTING: Not yet.
COLTON OGDEN: Oh, OK.
Is it on your to-do list?
VERONICA NUTTING: It is.
It is, it is, it is.
I have a long to-do list that's like
a multi-dimensional array of all
these different things I want to do.
COLTON OGDEN: Oh, man.
And we're going to cut here.
I'm just kidding.
[LAUGHTER]
VERONICA NUTTING: No, but
I haven't read it yet.
The class I'm taking is mainly
Russian short stories and poetry,
which is really interesting.
There's a remarkable amount
of Russian short stories.
COLTON OGDEN: All I know is that Russian
literature typically is very long.
That's the--
VERONICA NUTTING: So yeah, the short
stories are shorter, which is nice.
But that class is actually
called Strange Russian Writers.
So it's all-- right now
we're doing Madness.
I'm finishing up a paper on Dead Bodies.
COLTON OGDEN: Interesting.
VERONICA NUTTING: Is death final?
COLTON OGDEN: It's a somber note to--
VERONICA NUTTING: [INAUDIBLE]
[LAUGHTER]
COLTON OGDEN: "Pastebin is
pretty funny with the language
it assumes sometimes."
Oh.
VERONICA NUTTING: What's Pastebin?
COLTON OGDEN: So Pastebin is
assumed to the type based on code.
So does that mean that it was
interoperably functional with Ruby?
Because that would be fascinating.
"Going to have to make more time for
more reading," says bhavik_knight.
Yeah.
VERONICA NUTTING: Same.
OK.
COLTON OGDEN: Oh, I missed a
lot of these comments here.
Books on Tolstoy, War
and Peace, Anna Karenina.
Bhavik_knight much
more cultured than me.
I'm not into-- well, I'm not going to
say I'm not into Russian literature.
I have not decided to
take the dive into--
VERONICA NUTTING: That
was me three months ago.
Anyone can do it.
"Nah, it was Python."
Oh, but he's from--
COLTON OGDEN: Yeah.
I knew it was Python.
I just wasn't sure if
because it was .RB,
if the Ruby and Python
grammar are so close now,
that they're interchangeably parseable
in that instance, which would be crazy.
VERONICA NUTTING: And that's
another-- that's a whole thing,
the idea of-- that's cool--
interchangeable parseability.
COLTON OGDEN: Like, whether
a subset of a language is--
or whether a language can act
as a subset of another language
given a limited use of
the language, maybe.
VERONICA NUTTING: You know
what I haven't seen recently?
A good tree structure of the
evolution of programming languages.
COLTON OGDEN: Oh, interesting.
VERONICA NUTTING: I feel like
there are a lot out there.
But there are so many that it
should really be like a cool--
I don't know-- like a D3--
COLTON OGDEN: Yeah,
that would be perfect.
VERONICA NUTTING: --dynamic.
COLTON OGDEN: You could do a search
for it and it would open the tree to--
VERONICA NUTTING: Oh.
COLTON OGDEN: That'd be
really cool, actually.
VERONICA NUTTING: That's cool.
I like D3.
COLTON OGDEN: Type C
and it's high up-ish.
VERONICA NUTTING: And it says whether
it's been deprecated or parseability.
COLTON OGDEN: Yeah,
just have an API that it
could query for all that information.
It'd be interesting if
that actually exists.
Is that Flux that you
have on your screen?
That's why it looks orange-ish.
VERONICA NUTTING: Oh, it is Flux, yeah.
COLTON OGDEN: Oh, OK.
That's funny.
VERONICA NUTTING: It
just started because I--
COLTON OGDEN: A little
bit of Flux on there.
VERONICA NUTTING: That's funny.
COLTON OGDEN: "First language is
not English, it's third language.
So it kind of takes for me.
It's the way I improve vocabulary."
VERONICA NUTTING: Go, you.
Yeah, I always think--
yeah, go speak a bunch of languages.
COLTON OGDEN: Diving into Anna
Karenina just for some casual English.
That's impressive.
VERONICA NUTTING: Wow.
That's fun.
OK.
Good.
COLTON OGDEN: Yeah.
So, well, thank you, everybody.
Thanks to Veronica.
Thank you so much for coming into--
VERONICA NUTTING: What a nice community.
COLTON OGDEN: Yeah, this is so much fun.
So we'll have to do
another one at some point.
VERONICA NUTTING: For sure, yeah.
COLTON OGDEN: And I know you said
you wanted to do an assembly one.
That would be pretty crazy.
I'd have to do some reading up on that.
VERONICA NUTTING: Yeah, no.
We could definitely do systems--
I was going to say 101,
but even, like, Systems 50.
It's a really steep learning curve.
COLTON OGDEN: I wouldn't
mind being a part of that
and seeing what you're up to.
Because I don't do a
lot of systems stuff.
I briefly looked into at one point.
But being able to dive into a little bit
deeper than I ever went would be fun.
VERONICA NUTTING: It is fascinating.
And it's really funny--
right now a lot of people ask me,
like, oh, what CS class are you taking?
And I'm like, oh, I'm taking
a really low level CS class.
And everyone's like,
oh, so it's really easy?
And I'm like, no, that's not what
low level in this context means.
COLTON OGDEN: Yeah, people don't know--
VERONICA NUTTING: People don't know.
COLTON OGDEN: People not
involved in programming
don't understand that high
actually means simple--
or more abstract.
VERONICA NUTTING: Or
more abstracted, exactly.
COLTON OGDEN: And then low level means,
like, close to the metal, et cetera.
VERONICA NUTTING: Yeah.
COLTON OGDEN: More minute.
VERONICA NUTTING: The low
level stuff is really cool.
I feel like friends--
this is going to sound weird.
But I feel like I've never been more
friends with my terminal and computer
than I am right now.
COLTON OGDEN: Oh, yeah.
VERONICA NUTTING: Does that make sense?
COLTON OGDEN: Yeah, because
you're understanding it better.
VERONICA NUTTING: I
really understand it.
And it makes so many decisions
that I never thought about.
The compiler has this
really, really cool role.
COLTON OGDEN: Yeah.
VERONICA NUTTING: It's
a fascinating thing.
COLTON OGDEN: Yeah, it's a world
I'd like to dive into more.
So that would be a super cool stream.
[INAUDIBLE] says, "Thank
you, Colton and Veronica.
I had a great time."
Thank you, Bella, for joining us.
VERONICA NUTTING: "What is CS50?"
COLTON OGDEN: Yeah.
I don't think he's being ironic, though.
He says, "What is CS50?
I'm new to Python."
So if you're not sure what
CS50 is, it is a course
taught at Harvard by David J. Malan.
And Veronica is the head
course assistant this year.
VERONICA NUTTING: Yep.
COLTON OGDEN: Brian Yu is
our head teaching fellow.
He's been in the chat.
And it's just an intro
to computer science.
We go through a lot of different topics.
We teach it in C, we cover
JavaScript, we cover Python.
And all of the videos are available
online, all of our lectures.
So if you go to YouTube--
VERONICA NUTTING: All the materials--
yeah, everything's online.
COLTON OGDEN: Go to YouTube.
Veronica is even translating
into Spanish, which is awesome.
VERONICA NUTTING: Yeah.
COLTON OGDEN: But if you go to YouTube
and then go to-- just type CS50
lectures 2018.
You'll see David on stage in Sanders
Theater at Harvard, giving a lecture.
And like I said, it
covers a lot of stuff.
We teach Python pretty extensively.
VERONICA NUTTING: Yeah,
Python and C. We start with C.
So that's a bit of a
lower level background.
And then you work your way up and
go into Python and JavaScript.
It's really a great course.
COLTON OGDEN: Yeah.
And more than necessarily
the individual languages
is just the algorithmic way of thinking.
VERONICA NUTTING: Yeah, problem solving.
Again, it really just makes your
brain process life differently.
COLTON OGDEN: Yeah, it really does.
So definitely check that out if
you're not familiar with CS50.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Exactly.
We're super happy to
have people that are
new to the CS50 community coming
to us from Twitch, as well,
which is super great.
Mkloppenburg says,
"Assembly would be awesome."
VERONICA NUTTING: Beautiful.
Yeah.
Awesome.
COLTON OGDEN: JB Guy,
"Another awesome stream.
Thank you so much."
VERONICA NUTTING: Aw, thanks.
COLTON OGDEN: You did a great job.
For Sunlight [INAUDIBLE] said,
""[INAUDIBLE] Veronica should check it
out here."
Oh, tossed a link into the chat.
Awesome.
VERONICA NUTTING: Good.
Thank you.
COLTON OGDEN: [INAUDIBLE]
under the hood.
VERONICA NUTTING: Yeah.
COLTON OGDEN: Yeah.
That's one of David's favorite phrases
and it started to become part of--
VERONICA NUTTING: Oh, for sure.
Oh, yeah.
COLTON OGDEN: I say it all the time now.
VERONICA NUTTING: When
you're around someone
with such a unique way of
expressing some things,
you start to incorporate them.
So I have recently-- this is so weird.
I've been texting a lot if else.
So I'll be like, if at the dining
hall, please bring me an apple.
Else, don't worry.
COLTON OGDEN: Veronica,
you have to stop it.
You have to stop that.
We're done.
VERONICA NUTTING: OK.
COLTON OGDEN: "Good
to have you, Veronica.
See you next year."
VERONICA NUTTING: Oh, thank you.
See you next year?
COLTON OGDEN: Hopefully not next year.
VERONICA NUTTING: Like,
when I am a year older, yes.
COLTON OGDEN: Oh, yeah.
That's correct.
Although, by the time we do our next
stream, it might actually be next year.
Because the semester's
ending pretty soon.
We mentioned on stream before,
but this week is Thanksgiving.
Then the week after that's the
hackathon, and then the fair,
and then we're done.
Right?
VERONICA NUTTING: So
it might be next year.
COLTON OGDEN: Yeah, we might have to--
VERONICA NUTTING: Yeah, I might be
a year older in many different ways.
COLTON OGDEN: So much wiser as well.
VERONICA NUTTING: More wrinkles.
COLTON OGDEN: Yeah.
We'll set up another stream,
maybe past J term or something.
VERONICA NUTTING: "Sorry,
that was the Spanish link."
Happy there's a Spanish link.
COLTON OGDEN: What happened?
"Sorry, that was the Spanish link."
Oh, that's awesome.
VERONICA NUTTING: That's great.
COLTON OGDEN: That's awesome.
"Finished a doubly singular linked
list implementation, but that's all.
I'm a student," says [INAUDIBLE].
Awesome.
That's super cool.
If it wasn't C or C++, then
you'll fit right along in CS50.
[INAUDIBLE]
VERONICA NUTTING: Aw.
COLTON OGDEN: So we tried our
best to keep up with the chat.
VERONICA NUTTING: Yes.
COLTON OGDEN: There was a lot of it.
VERONICA NUTTING: Yeah, so much.
Wow.
COLTON OGDEN: I'm super
happy that it was.
Because this involved-- [INAUDIBLE].
Come on.
The involvement of the
chat is super cool.
I'm super excited about it.
VERONICA NUTTING: I think that's
what makes, again, this type of thing
unique.
Because it's, again, a
conversation, which is cool.
COLTON OGDEN: Yeah.
VERONICA NUTTING: Very dynamic.
COLTON OGDEN: And it's
been a lot of fun.
And this was a great stream.
VERONICA NUTTING: Yeah.
COLTON OGDEN: It was
great to look into Python.
This was the second
Python stream we've done.
But that was a specific use case.
This, being able to go down
to some more fundamental stuff
and then work up to an example.
It was super cool.
VERONICA NUTTING: Yeah.
COLTON OGDEN: And would love to
do more of these types of videos.
Yeah.
So let's definitely do that.
But yeah.
VERONICA NUTTING: Yay!
Thank you for joining us.
COLTON OGDEN: "She's super
funny," says bhavik_knight.
"Not even Spanish.
For some reason [INAUDIBLE] forcing
Spanish on me from time to time.
Dutch native here."
VERONICA NUTTING: That's funny.
COLTON OGDEN: Time to
learn a new language.
All right.
So I'm going to bring us
back to the wider shot here.
So thanks so much, everybody.
Tomorrow, tune in for David J. Malan.
And I will give a--
mostly, David J. Malan will be giving
a RegEx tutorial, some cool examples.
And this is CS50 on Twitch.
My name is Colton Ogden.
VERONICA NUTTING: This is so weird.
Because it's opposite or something.
And I'm Veronica Nutting.
Thank you so much for joining.
COLTON OGDEN: This was not 100
cool things to do in Python.
It was probably, like,
40 or 50 cool things.
But we will finish it off.
VERONICA NUTTING: We're
going to get there.
This will be, again,
a multipart situation.
Yay.
Thank you.
COLTON OGDEN: So I will
see all of you tomorrow.
Have a great rest of your day.
