all right hello world this is cs50 live
my name is Colton Ogden cs50 unfamiliar
for watching this on YouTube on twitch
on Facebook and you're not familiar with
cs50 cs50 IDE in true to computer
science taught by David Malin my name is
Colton Ogden this is an offshoot of that
and this is sort of a live interactive
series where we do a whole bunch of
different things we program things from
scratch projects from scratch I
typically do games and web stuff we also
talk about technologies and libraries
all kinds of stuff but this is a new
thread where we're actually trying out
an experiment where we have the sort of
the twitch chat coding for me I'm sort
of acting as a proxy and so what what
the sort of system is that we have in
place now is and I'm just gonna go over
and write this in the chat here just
that everyone knows if anybody is a
newcomer to this idea if you're on
Twitch you can enter Smiley's emojis and
there's a bunch of different emojis if
I'm familiar with twitch that are very
common on Twitch and sort of hallmarks
of the platform one of them is the
mister Destructoid emoji and so right
there you can see it there's three of
them that is the marker for you to tell
me that you want to write a line of code
in the script today or amend somebody
else's line of code just basically the
participation marker and so right now
you can go ahead and start doing that
but if I see those three robots that
tells me okay add so-and-so's name to
the roster and we will we'll get started
now I'm gonna switch to my computer and
you can see that a couple of folks
actually put the emojis in the chat
before the stream began while we were
doing the music so as the t & soha Zoar
are the first people that are going to
be participating in today's experiment
now last week what we ended up doing is
kind of a couple of different things we
did a a chaos sort of run which almost
sounds like a game thing we did a chaos
project where there was no goal we
essentially just said you know in order
of whoever wants to participate just say
a line or an amendment and we will run
the script when we get to a point at
which is runnable and we finally got
that runnable and it was it was crazy we
it was memes all over the place but then
we finally got after that to a more goal
oriented project where we actually
implemented an ASCII square and that was
cool because we had the sort of witness
is the assumption that some people are
gonna take it seriously and some people
are not gonna take it seriously and
that's why it's entertaining and I get
to sort of sit back and sort of referee
the situation but like kind of enjoy the
process and it's funny to see people
take the sort of the the troll sort of
submissions you know where it's obvious
that they're trying to kind of steer the
project away from completion for the
sake of good intended humour of course
but then to see like other people who
want to see the project complete it
actually amend lines or add lines in
order to make those lines not work in
the project and so you kind of get to
experiment with what you're capable of
and how you can sort of fix any code
base given any sort of unfortunate
situation now some people just went
ahead and submitted the robots as well
so I'm going to go ahead and write them
in so the choko kid 21 we have and I
apologize if I typo your screen name
some of these are a little bit tricky
call them Poros pour offs and auto at
zero and cano how are we gonna be able
to comment outlines in this stream that
was another thing that came up that was
interesting so I don't think so
so no no commenting outlines because
that's a very easy way to sort of get
rid of somebody's work so what I think
we're gonna do is instead of doing that
we will there are definitely ways that
you can take somebody's line out of the
equation using Python constructs like if
statements are loops or function
definitions all kinds of things that
actually introduces more interesting
ways of using what people have built up
later in the project so nono commenting
out no deleting lines you can amend the
line you can make a small change to a
line that will sort of be up to my
discretion whether that's a valid
amendment because obviously you could
say I amend this line to be completely
deleted completely gone that will not be
a valid amendment but if you want to
change something small about somebody
that ulties line you can propose an
amendment
make sure you specify your amendment
specify your line and no commenting out
man I think that's roughly all the rules
that we decided on that we would take
this time just so that we make sure
everybody's work gets sort of equally
valid sort of create an out credence but
consideration cool then we just make
sure we're meeting the chat
some folks are potentially saying
there's problems with the stream I know
Facebook is having some issues today for
some reason hopefully if you're on if
you're watching on Facebook and it's
having issues go to twitch twitch TV
slash cs50.tv so that you can
participate in the in the chat and
actually be part of the part of the
experiment because this is a
particularly bi-directional day because
a lot of the time we do have a
bi-directional but it's more of a
project that I'm building or someone
else's building and we'll take sort of
input and we'll answer questions but
it's not nearly as bi-directional as
today streams that work by you were
literally writing everything that it
goes on in the script today and I was
also doing some research on twitch BOTS
and there might be a way to turn this
turn at least the robot side of things
into a twitch bot if not the entire
script writing process but I have to
take a lot of I have to take a lot
closer of a look at that and actually
experiment with it and test it because I
have no idea whether that's one
completely safe and - as possible and
streamlined as I'd like it to be for
this channel how do you use procedures
and functions you would just do write a
function like def some function which
could take in some argument and then you
would say you know some function call
some other function call right this
would be a function and this would be
the definition this would be the body of
the function so what is the goal so
that's interesting because he had
question trucha nice the goal today I
think what we would do some people
actually proposed project Euler last
time and I think Brian actually in a
prior stream perd suggested project
Euler was one of the the sites that he
liked for problem solving and so I think
that might be an interesting way
for us to create a goal for today's
stream unless you want to brainstorm
something else we want to decide on a
goal collaboratively but chaos was a
little bit if people want to do a chaos
I'll leave it up to the stream but it
ended up being kind of like the goal was
more interesting because we actually had
something that everyone was fighting for
we had this tension between you know
people that wanted to prolong the stream
people that wanted to people that wanted
to actually solve the problem so and
then wolves that will add you as well
so but if there is overwhelming
consensus that chaos is what we want to
do especially if we have a lot of people
that didn't that weren't here for the
first time we did this stream then we're
I'm certainly open to that I ultimately
want this to be entertaining for
everybody so so Huzoor the goal oh the
goal was to essentially make a make a
box that look like this you know but
actually square but to actually have
this be like an input from the user the
user would input like five and it would
draw a five by five square so it was a
pretty simple goal we're gonna do Mario
eventually but people propose that that
might you know be against academic
dishonesty guidelines which is
completely valid so we will we'll stay
away from anything cs50 problem set
related and just do custom problems here
where there are infinite problems we
could come up with so we don't have to
we don't have to stick with purely cs50
problems so when do you do the streams
typically they are Wednesday Thursday
Friday for now because Mondays and
Tuesdays this room is sort of in use for
other purposes but you can expect
Wednesday Thursday Friday sometimes not
Friday it really depends on what's going
on here at the office well you know
there's we have a lot of other projects
but we unfortunately have to spend a lot
of time on and this takes up a good
amount of time so we try to get this in
as much as possible but we don't do it
you know as much as your average
full-time twitch streamer for sure so
why don't we go ahead and take a look at
first of all gonna save the name so far
and cut this music actually and let's go
ahead and take a look at project Euler
so I don't remember the name of the
website or the website domain Patrick
and they have an archive section here
and there's a lot of a lot of problems
there's you know this is page 50 there
is 14 at least 14 pages 100 there are
655 problems so the we can start with
something fairly easy like the first
problem which is if we list all the
natural numbers below 10 that are
multiples of 3 or 5 we get 3 5 6 & 9 so
we need some way to identify whether a
number is a multiple of 3 or 5
not 3 & 5 but three or five and then add
the multiplied the multiple so in that
case if you add all those multiples it
becomes 23 the problem here is do the
same thing but for all the multiples of
3 or 5 below the number 1000 so we could
we could use this use this problem as
the basis for our stream we could also
look at other problems but there are so
many problems on project Euler that I'm
not sure if we want to spend too much
time digging into you know reading all
these problems where we actually get
started writing code so if you want to
try the multiples of 3 or 5 oh and also
another rule and this is this is good
for for what we're hearing from unknown
boy act now in the chat you cannot do
compound statements in Python so you
could not do something like which was
what they did which is a for loop 4 + 0
26 which would actually be range I think
rain oh can you do 4 in tupple does that
work I'm actually not sure but basically
this has to be it's its own line
submitted by somebody you can't do this
and then do another if statement and
then do another line after that it needs
to be it needs to be a it needs to be
just the first part so real CS is what
happened to the stream so are people
seeing people are seeing the twitch
stream right technically but it will
just give you 0 and 26 okay yeah I've
never seen I've never seen tuples syntax
used in in a for loop in Python I always
see range for numeric iteration but
there are so many things that I don't
know okay so so I'm so sorry for folks
that are watching and
people on other platforms that are
seeing weird stuff I do fear on youtuber
Facebook come to twitch probably because
twitch is the stablest platform right
now and we'll we'll figure out the other
situation later did I go dark cold wet
dark what does that mean but does it
work really and just make sure I'm
reading the chat and make sure I see
everything okay so why don't we I wanna
make quite light yes good that's that's
generally how I am you are disconnecting
from real life so what I think we'll do
well probably we'll probably just do
since it's the very first the very first
[Music]
problem on project Euler and this is the
first time we've done a project or thing
let's just do the very first problem and
save ourselves the time of actually
going through all the problems finding
one and you know cuz we've already spent
a few minutes with the technical
difficulties that we're having today so
yeah let's do this let's do the list
I'll copy the project Euler sort of
problem spec here right for problem one
and make it a top-level comment here
cool so we're gonna find the sum of all
the multiples of three or five below
1000 and as another note just let me
know when you're writing or your comment
what line you want your your your line
of code to go on or specifically that
helps me quite a lot Oh Ashley's gonna
leave right before right before her turn
and she wants to leave an amendment for
whatever meow cat puts in so you know if
you're if you have if you didn't watch
the prior video meow cat diverted us to
say the least but it was it was
entertaining
dance trainer I have you so as Li if you
if you're sure but it's your turn and
we're ready to take your input now if
you want to get us started but if you
are indeed leaving we can we can skip
down to sofas or let me actually make
sure I didn't miss anybody else writing
the three
I don't think I did no I did not okay
perfect cool so wait just a second
confirm
can you move me to the bottom I'll grab
something to eat yep absolutely
and done amendment for the future if
colons heresy equals short that's not
valid Python syntax Ashley you can't you
can't assign an if statement yet that's
added in Python 3.8 though that will be
added alright thanks for thanks for
popping by Ashley we will hopefully
we'll see you again in the near future
you will live on in our in our memories
but we'll take the we'll take the first
line of code from so odds or so so
Hazara you're leading the way if we list
all the natural numbers below 10 that it
multiples of 3 or 5 we get 3 5 6 & 9 so
basically we want a way to get all of
the natural numbers below a thousand
there are multiples of 3 or 5 so we're
gonna need a way to get them all and
then sum them and then figure out what
the sum is of that information
mBLAQ's hello Sosa Hazara we are waiting
on your line of code so huzoor if you're
if you're still in the chat if not we
may have to go down to colum for us and
if anybody is watching and is unfamiliar
with what goes on if you want to add
code and get your name added to the list
just in chat and twitch chat right 3mr
Destructoid emojis in a row yes M Brax
you may join I need to make like a like
a title card or something that are like
a title outline or something that'll say
you know enter three mister Destructoid
so that people watching the video no
matter what we'll see that and they
don't have to rely on a twitch bun or
anything so okay so def project nice
we're off to a fantastic start
so Huzoor and as always for the last
[Music]
code base that we were in we're going to
put everybody who's participated their
name next to what they actually add it
to the project just so we can keep track
of who's added what colum pooris you are
next
so let's see what you have to add to
this amazing project that we have so far
and again it helps me a little bit if
you do if you specify the line and also
if you're if it's in a function or a
statement kind of specify the
indentation level to say indent into you
know function and write this line it
helps a little bit because python in
Python whitespace is important if you
write something in here versus here it's
completely different so something to
keep in mind if you are gonna
participate andre hello good to see you
Lag we fan here says i rocks I'm not
even sure what that what that is I
apologize but if you want to participate
in today's stream 3mr Destructoid's puts
you in the roster that goes to you as
well Andre if you want to participate
for I in the range of a thousand okay
for I in the
of 1,000 that's an excellent line I feel
like that gets us somewhere so let's go
ahead and put column poorest there
what's the best way to denote whitespace
in a twitch comment you can just say I
mean yeah if you if you put an
underscore I can assume that to be in a
level of indentation actually so that's
actually pretty nice concise sort of I
guess syntax for that so yeah I'll
accept that so odd to have zero it is
not your turn
yogi 20 22 if I'm on 3 and 0 I'm on 5 is
zero so again if you're if you're
writing in the chat and you're not in
it's not your turn I won't accept your
your answer but if you want to get added
to the queue then just write 3 mr.
Destructoid's in the chat and I will put
you in the queue yeah I'll take I'll
take backslash T I'll take underscore
I'll take the word indent and people are
free to write if they if they want to
write suggestions they're free to write
it but they just won't be considered if
it's not their turn if they want to if
they want to you know people that are if
it's their turn they are free to look at
other people's suggestions and use that
as inspiration for their own so Kinesis
saying aw damn is not present that you
which is unfortunate so cannot it is now
your turn we will accept a line of code
from Kanade and again 3 mr.
Destructoid's if you want to get if you
want to get added to the list of
participants you can see them right here
in the in the Python file so again we're
trying to get or trying to build
collaboratively a all the sum of all
multiples of 3 and 5 below 1000 so if
you would like to participate please do
put 3 mr. Destructoid's in the chat and
I will see it and I will write your name
note is better than Python says suhoor
sounds like a very opinionated statement
to make Eric Cartman hello good to see
you
set a timer for everyone I have sort of
a timer in my head so it's kind of like
if a 30 seconds to a minute passes then
we'll take folks out
Kanaan is usually pretty pretty present
which is why I'm spending a few seconds
waiting but I think after a few more
seconds we will we will let yes Iike
knowledge is there so if I mod 3 is
equal to 0 or I mod 5 is equal to 0 and
I'm gonna go ahead and indent these over
just because it's a little bit longer
great line by connacher unknown boy
racket is not your turn it's better for
the stream if people make mistakes and
others have to make amendments you need
to add a break statements as M Brax
well CH o quick kid that the goal here
is to get people of different experience
levels involved and so if people try if
people more people participate and make
mistakes then we have amendments to make
so that's why we need everybody to
participate here so unknown boy wants us
to print I okay we'll do that and I have
not been keeping up with the followers
so thanks so much to uh tone boy AK
wolves 46 yogi 20 22 and ninja Vedas
very much appreciate it
break could break everything yeah that
would break the that would break us out
of the for loop at least okay so that
was unknown boy yak and it could be
unknown boy a K and I'm just
mispronouncing the name so I apologize
if that's happened why don't we run our
why don't we run our script let me clear
this out and I think we're yeah we're
here let's go to the Python what is it a
where am I at
Oh chat codes Python to check codes
Python 2 and then if we do Python 3 of
mein I think it's Meno script one dot pi
we get nothing yet okay so nothing's
getting printed to the screen yet which
is okay so rule CS wants to get at it
I'll add Cyril and Andre says Oh see it
myself oh that was a joke Andre I see
nice
so one track system it is now your turn
you need to have some difficult lines of
code - hey it's up to it's up to the
stream right you know if any if people
want to do you whatever they want to do
they should participate and contribute
in whatever way they see fit but one
track system it is now your turn to take
this script to its next destination so
currently the script prints nothing at
all absolutely nothing at all a BTech 18
you have been added to the roster and
call them puros is back in there for
their round to add var total sum equals
zero after line 8
Oh what's one track system right okay so
on line eight it is in haste
hey Sokka nice turn of Python I'm
guessing that means you are the Jesus
Christ of Python says my r68 mood is
good eyes is better no estoy i think
that was correct yeah and this is that
was one track system which said it was
it total so far okay so this is this is
gonna be an interesting thing VAR total
sum is equal to zero so you know I I
might just leave I might just leave
errors lab might just do what like
exactly how people type their lines of
code and we'll we'll just kind of let it
exist and I have a linter installed now
so we can see that things just got
really nutty as soon as we did that but
that was one track system so one track
system thank you for your contribution
we have Knaus and diem SMTP being added
to the twitch stream
after the docstring import time sis OS
just preparing for the future sorry you
can delete VAR one track system I'm
afraid it's too late you have already
locked in so somebody is gonna have to
amend your line of code if you want this
to work this will make things a little
bit interesting right and this is how
we're gonna learn I think this is a good
way of learning mistakes to the caballo
says keep var in there I like they be a
literal transcribing yeah I think it's
interesting I think it'll give us a
little bit of it'll give us a little bit
of hilarity to work with for the stream
you know a little more interest puppet
4411 was after the docstring import time
sis OS okay import time sis OS that was
puppet 44:11 and wolves 46 it is now
your turn if someone to call projects
even prints anything since dance trainer
hey it's a good idea someone comment out
line 8 we are not accepting comments em
Brax
Oh Joker kid stream was frozen I'm sorry
all right wolves 46 is no longer present
dance trainer it's your turn let's see
what you got
loner King 10 is back from last week
this pc10 what's up what's up this pc10
again if anybody's brand new doesn't
know how to participate three mister
Destructoid's of the chat will get you
added to the roster for adding some code
to this amazing script we have here so
dance trainer it is now your turn
dance trainer is thinking they're saying
hmm
take this moment to hydrate a little bit
I'm a little bit parched
dry mouth
you can do /me thinking oh nice okay it
should say is thinking I'll do it I said
ad project as a function call okay so I
I will assume you mean right here so
this is courtesy of dance trainer we are
calling the function now that we defined
up here and now it is on to the choco
kid 21 for their contribution to the
script so how Dora wants to get added so
hazor and dance trainer wants to get
added back to the end will do cool cool
between line 13 and 14 X plus equals I
13 and 14 X plus equals I okay all right
here choco kid 21 everything is nicely
lined up here nobody is that nobody's
requested an amendment yet so we haven't
had to do over line comments just yet
but I suspect people get there at some
point so oh I not one
oh sorry my fault even I'm making
mistakes I'm supposed to be the one
transcribing or it forward
but we are not printing X it says sanam
boy ak it's a good observation
can I get added back to the queue
absolutely
Exce not defined says undone boy yak
they might be onto something em Brax it
is now your turn so just waiting on em
Brax bella says hi hello Bella Bella
would you like to get added I know that
we accidentally forgot to include you
last time I'd be happy to add you to the
tuning roster right now if you would
like to participate we need to add the
multiples not print them so as the choko
kit and this is where we arrive at the
fun of the stream where we have
different people trying to do different
things that may or may not accomplish
the goal at hand Bella wants to be added
all right Bella again apologize that we
missed you last time but you are in
there we will get you in here we will
get you participating replace var total
sum with X equals zero okay so we want
to amend this line to say X is equal to
zero okay we can do that
oh I'll consider that a valid amendment
an amendment from M Brax since the line
effectively accomplishes the same thing
and this is going to be x equals zero
now notice that that got rid of all of
the all of the errors that we had
because var is not a key word in Python
that is the way in JavaScript to define
variables but python does not have the
VAR keyword so sir rule c yes that is
now your turn oh we've got to take a
break okay that is totally fine we can
we can push you off of the of the roster
here that is not the way in JavaScript
it is the old JavaScript now you can say
let you can say constant do it the old
way the es5 way to program in JavaScript
was to save bar or something
yes var is outdated that is correct but
it is technically JavaScript syntax
still it is still technically part of
the language
nqm Brax please can do and Yogi 2022
says can I join yep absolutely
there is no underscoring your name what
is the URL for submitting a code for
review the URL for the code review is
going to be cs50live view like that and
truká nice thank you very much you
almost beat me to it
not quite I beat you by just 5
milliseconds you should have a bot for
queuing I agree I was going to I'll
actually looked into that this morning
as to how to write it and so I think for
the next stream I might write a twitch
bot for that but yes you're absolutely
right it looks pretty easy too it's not
too bad it probably only take me like a
couple hours we need only an amendment
to complete this project this PC tense
is code review
clap clap yeah it's fun stuff code
review is good and then David is a David
is gonna be doing the code review on
Friday tomorrow so tune in for that one
that will be interesting have you had
bad clever actors yet not yet not yet
everything seems to have been pretty
wholesome so far honestly yeah I'm
really a merlyn's correct this is a
one-liner with a list comprehension and
the sum function this is a list
comprehension Bella this is the goal so
listing all the natural numbers below 10
well actually technically not listing
them but getting all the natural numbers
below a thousand and then adding the sum
of the ones that are multiples of three
and five oh I did not get the pedes
reference I apologize I do not watch
PewDiePie I used to watch PewDiePie a
little bit but I do not watch him these
days I probably am missing some kind of
a reference shame on me
Meem review actually that'd be pretty
amazing it'd be pretty amazing meeting
review with David Mann there I'll think
on that a little bit I'll think of it
that's interesting so sir rule this rule
get did sir rule decided that they
didn't want to contribute are we going
to a BTech to rule said bye-bye right
yes rule said got to take a break I'll
be tech 18 it is your turn we rest on
your shoulders
we have like 12 or so people in the
queue
so again if you're watching this and
you're not in the queue to submit a line
of code you can type 3mr Destructoid
robots in the chat that'll tell me that
you want to be added to this roster of
people who are going to we're gonna
contribute a line of code to the project
a BTEC 18 says print X outside the for
loop and inside the project ah okay so
right here so we're gonna do a print X
and that is a BTech 18 excellent so why
don't we run it just to see what we have
so 233,000 168 this is the number that's
being printed that's X is this indeed
the sum of all of the numbers below a
thousand that are multiples of three and
five surreal CS wants to get added okay
and so does aa BTech so I'll be tech
eighteen and so rule CS now are the
solutions on project Euler as well does
it actually show you what the that could
we confirm the solution on here anywhere
or do we just kind of have to know what
it is or do you have to like actually
sign in and submit so thing we need to
get rid of all the outputs you know it'd
be kind of interesting is if we just oh
Sora has a link okay
oh yeah we yeah we pretty much did it
right yeah and then actually what a in
the stackoverflow solution the which is
the X is sort of equal to the the
generator expression within the sum I
for I in the range of thousand five mod
3 is a zero i mod five is equal to zero
yeah that is that's the one liner that
Merlin was referring to and oh there's
an actual project solutions oh those are
just the solutions the answers okay cool
yeah without the without the without
this print it would it would indeed be
cleaner but we're not necessarily going
for perfect code we're going for getting
the answer and we got the answer right
so well done to all the chat that was
amazing that was very fast actually no
nobody screwed that one up too badly I
will say nobody nobody tried to steer us
off the wrong path so shoutouts to
puppet 4411 so Azure M Brax one track
system : poor s cannot the chaco kid 21
unknown boy yak l btec 18 and dance
trainer for the contributions so very
well done and a BTech yeah that was I
got you in there as well very well done
all of you let's uh let's go to the next
problem do you want to go do we want to
go to the next problem or do we want to
do you want do something else we just
write this a script tune up hi how much
does pep a style matter in industry
probably a good amount I think it's
gonna vary on your organization cs50
tries to adhere to it pretty pretty
firmly but I think even we deviate
sometimes in subtle ways but generally
we try to adhere to them almost strictly
the next problem before meow cat arise
all right amazing so okay task two let's
do task two
starting with the roster people that
carried over from script one so we're
gonna go over to project Euler let's
look at task two and let's understand
what it is so the even Fibonacci numbers
so each new term in the Fibonacci
sequence is generated by adding the
previous two terms so by starting with
one and two the first 10 terms will be 1
2 3 5 8 13 etc so we get 1 plus 2 and
then the next and then the next number
is going to be the sum of that the next
numbers after that's going to be the sum
of these two then these 2 then these 2
and then these 2 and you can sort of see
that so we have this list of numbers
that grows and then the next number is
the sum of whatever the last two numbers
were starting with 1 and 2 that's sort
of the initial way that we seed our data
set right so we want to consider the
terms in the Fibonacci sequence whose
values do not exceed 4 million
find the sum of the even valued terms so
we want to basically calculate Fibonacci
up to but less than four up to four
million so equal to four million up to
less than or equal to four million and
then find the sum of all even-numbered
terms so this is this is a juicier
problem this is interesting it's a bit
more complicated than the last one we
did but totally definitely solvable I'm
gonna go ahead and copy the the problem
spec into the end of the script let's go
ahead and do that and just do this and
this so here's the comment right here
the first person to kick us off is
calling porous so callin porous let's um
let's do Fibonacci first then the sum
later yeah I mean there's there's all
kinds of ways to be doing this we'll see
we'll see if people if we can align
everybody's goals and thoughts along the
same sort of axes but it's ultimately up
to the chat ultimately up to the chat so
def okay so call them poor column for SS
def next fib num : all right
so--that's : porous
the next person is cannot so cannot
let's see what you got
see a little bit of red here I'm not
sure I'm not sure what that is but maybe
we'll figure that out before too long
unknown unknown boy a K or uh none boy
AK added you so Horace has put brackets
hey says so huzoor it's not your turn
you're gonna have to wait your turn
canalla it is your turn what would you
like to do to this script and let me go
ahead and just shout out the people that
are falling on twitch so whoops it's
code of life and I'm a Helen thank you
very much for the follows much
appreciated connacher says they're here
and again to anybody who's new to the
stream if you would like to get added to
the roster of people to add lines of
code do just throw 3mr Destructoid
emojis the green robot into the twitch
chat I will see that and I will add you
to the list we can define an inefficient
fib function in one line Merlin is
Merlin wants to get fancy Merlin once
the Merlin wants the and we won't accept
that though
Merlin because again we'd want to accept
compound Python statements but the
actual gist of what you're saying is is
true however that is a that'll give us
the number right that'll end up giving
us the Fibonacci it won't give us a
sequence I'll just give us a number
right yeah that was give us a number so
I'm not sure if that'll work in this
case no you have a : Merlin you're deaf
has a : that's a compound or like a it's
like an inline statement essentially
essentially no loops no one-line loops
it conditions or function declarations
anything that you would use a : for
is a yeah the block is on one line but
we're not we can't accept that they
can't accept anything that's multi-line
like that cannot said sorry what's the
function doing so here I'm gonna go
ahead and just leave this up if you want
to read it it's a the Fibonacci sequence
right so every two neck we start with
one and two add those which creates the
next number which is three add the two
next numbers which are two and three
that creates five add that to the list
the next three not the next two numbers
are three and five add those that makes
eight five and eight makes thirteen
eight and thirteen mix twenty-one so on
and so forth let me make sure
one tribe Robitaille bruh but i cannot
spell one-track system and one tax
system and call them for us also merlin
are you even participated to this with
robots at all ever
you do seem to know Python pretty well
yeah Merlin it sounds like you're
probably your prom
you're probably seeding the pool of
folks in twist shot and inspiring them
with your with your with your statements
though not directly contributing you're
sort of indirectly contributing and it
looks like Knaus wrote initialized
result to zero I'm gonna need to know
where cannot where do you want me to put
result equal to zero you want me to put
it in here going to put it outside the
function here do you want me to put it
up here what are we where are we putting
result
because again python is whitespace
sensitive so if we put if we put a
result here it's different okay
connections inside the function okay
awesome
so result is equal to 0 that is courtesy
of Knaus will go ahead and we will write
credit to connacher right there someone
use matrix multiply oh dear
DM SMTP it is now your turn what do you
have for us today matrix exponentiation
absolutely beautiful idea no danger in
that getting unwieldy whatsoever
okay DM SMTP a is equal to 1 and where
are we putting that if you could do me a
favor and specify to when it's kind of
ambiguous whether whether you want your
statement sort of up above here maybe or
inside the function or after the
function outside of it just because in
Python especially there are I mean even
in any programming language placement
matters a lot and I want to make 100%
sure that I know where you want your
code to go and I don't make too many
assumptions great new 9 I got you down
here line 12 11 Oh between 12 and 11
okay so we'll say a is equal to 1 and
that is DM SMTP awesome thank you very
much Monge 1h or monkey 1h what you got
for me what is the next contribution to
this stream and also thanks to Raiden
Samba 1996 Ryan when how and treat it
for the follows in line 14 while X is
less than 4 million ok
that is a Monge 1h thank you very much
for the contribution loaner Kington it's
up to you now what do we got DM smtp i
will add you DM smtp back to the end and
puppet 4411 you've been added
I am new but trying no it's excellent
that was a good line that we do not have
an X variable but we will we will do our
best before we have did we solve the
first problem we did solve the first
problem we solved it with flying colors
Santa Claus is real love the screen name
hello anybody new who is joining the
twitch chat 3 mr. Destructoid's puts you
in the queue to add a line of code to
the script if you would like to
contribute so do do that if you are
curious if not feel free to be a relaxed
passerby in this journey this amazing
journey loner kington says be is equal
to 2 it might assume that the line goes
here loner kington or somewhere else
again if you are contributing and it is
ambiguous or if you want to just start
doing this as a as a sort of an weirdo
was like going with that I lost my train
of thought if you want to be if you want
to do me a favor and be a little more
explicit consistently everybody by just
giving me the line number with your code
that will make things I think a little
bit easier a little bit more efficient
on line 13 okay excellent so on line 13
B is equal to 2
courtesy of loner cannot type loner
Kington awesome so hazhar it is now your
turn what is the next contribution yes
by submitting the cope was saying line X
here's the code makes my line way easier
mentioned nm if you want to contribute
you will need to get added to the queue
so if you want to get added just put 3
mister Destructoid emojis in the chat
and I'll know that you want to get added
again anybody who's writing code if it's
not your turn I will not be writing it
but if you want your code to be
considered if you want to contribute
then just add put three mister
Destructoid's in the chat and I will
call on you when it is your turn in the
queue but so hazhar it is currently your
turn I see that you added three robots
in the chat earlier but not any code yet
so before I add you to the queue we're
gonna need some code from you loner King
tip you have been added back to the list
so as or if it takes too much more time
we might skip you unfortunately
Raj SNK 501
so as oh are you going to write code or
ad1 do you want us to skip B for now
can't think of a wild thing that's okay
if you want well we'll pass will add you
back to the end of the roster how's that
dance trainer it is now your turn call
the function show the code code is right
here currently can I go for four
so Hazara I'm not sure what you mean
you'll have to specify your line of code
you can you can amend you can make an
amendment to the while you can specify a
new line but I'm not entirely sure I'm
probably gonna refrain from giving out
too many hints too many too much code
advice I will let the people in the chat
doing that if you do have a Python
related question syntax wise and you
want to ask I can ant I will answer that
but if you make it outside of the
context of the problem like if you if
you yeah
okay so sorezore ended up amending the
line so amendment from so has or and it
is close enough to this line so I'll
consider it
so for I in the range of 4 million cool
thank you so huzoor so dance trainer
just now your turn hello Martin good to
see you again anybody anybody is new and
doesn't know what's going on and wants
to participate just type in 3 mister
Destructoid's in the chat it looks a
little something like this
whoops that is not what it looks like
what the heck is going on
but if you want it to lay if you want to
contribute to the chat just write that
and that is that is what the marker is
to participate
chuka knees has requested to be added so
trucha knees is going to be added to the
chat
what if somebody writes something that
deletes something from your PC
thankfully I am pretty wise as to
probably what will delete things from my
PC so I will not I will not accept
anything that is malicious and the part
of the fact of deal of avoiding compound
lines of code is to get around that but
a dance trainer it is your turn
are you present I did I do see a comment
recently from I do see the comment from
dance trainer does the code have to be
relevant to the problem doesn't have to
be it could be anything as long as it's
not going to try and wipe my computer
line 17 if I is equal to a plus B if I
is equal to a plus B and that is from
dance trainer
okay awesome thank you so much
Cho go kid 21 it is now your turn let's
see what you got
rj SNK 501 I got you
and come on choke a boy this is true
canoes
Swayne uncho cook it I want to make an
append I okay
what is the append
you would if there's a list you can say
like if I had a list called K that was a
list like this I could say K dot append
some value like that and that would add
some value to the list inside of it like
that essentially
excuse me
so hopefully that was helpful Chogokin
Joey says all right just skip me hmm
excuse me bail occurs it is your turn
and a pink six at the end here I'm out
see y'all next time
all right one track thanks for thanks
for joining today someone have been Hopi
is the single the four million you can
do just comments right yeah you could do
just a comment if you wanted to as long
as it's not come commenting out
somebody's line of code that is fine
although why you would want to spend
your code on a comment might the I'm
curious but we'll see we'll see what you
will see what you have in mind
oh I see and Joker kid was here
alright choke okay we can do that for
you but where do you where do you want
the where do you want the comment Cho go
ahead we're gonna you're gonna have to
tell me where you wanted
Bella says line 18 outside the if
statement so right here or I guess it
would be right here if number mod 2 is
equal to 0 so if I'm reading this
correctly so you want it like like right
here
so if number mod 2 is equal to 0 like
that is that correct Bella let me know
that that is that is what you're going
for no troll lines lame says Erik line
15 we're in the middle of the function
all right
choko lu choko kid was here beautiful
thanks Jo go kid for your contribution
you will forever be known grab Snickers
22 4 in choke Ovilus here well if you
could confirm that I put the if I put
that line right where you wanted it and
it looks like how you wanted it to look
cool awesome
and yogi 20 to 20 20 to the we do not do
compound statements so you cannot do an
if and a something it has to just be an
if or the body itself the statement
itself
biggest contribution of Austria the CND
TV channel yeah
there's a string with multiple new lions
count count as multi-line no if you want
to print a if you want to print
something multiple lines that's totally
fine your Python statement just can't be
multiple lines mr. Sutherland says one
can do a list comprehension let's go can
one do a list comprehension you can do
anything that Python allows you to do as
long as it's not more than one line the
worth of code and that includes anything
that you would use a colon for like if a
def for etc yogi 2022 after line at 17
what exactly do you want after line 17
because the line that you proposed is
actually two lines so we can only do you
can only do one of the other or
something else like we don't allow an if
with a colon and something else you can
you can as a single person in the chat
offer up the condition that if something
or the result like what trucha niece is
saying what if it's code has a comment
and someone removes the comment symbols
that's fascinating since we can't
comment out code then probably will
won't allow that just because then
there's no way to fix it after it's
happened so probably not gonna do that
let's start returning lambdas yeah there
we go but it's a very it's an
interesting idea because that adds a
that adds some interesting new things if
we were programming in Lisp I feel like
we would have I feel like that would be
actually completely valid way to do
stuff sorry for that comment trying to
write code oh that's okay
yogi 2022 so what is gonna be what is
your final contribution lemma is a to
high IQ for twitch no it could be fixed
by an if false well no because the
interpreter is still going to read it
and see a syntax error
dance trainer wants to get added to the
end absolutely cool so if my mod 2 is
equal to zero and you said that was
after 17 right here so if if three if
statements here if I mod 2 is equal to
zero which is essentially the exact same
thing that Bella did right here with a
different with a different name
alright so that was a contribution by
Yogi 2022
so ember acts it is now your turn
you've had a lot of interesting ideas
throughout the stream so I'm curious to
see what you contribute twitch is too
chaotic for lambdas because they are
higher order and that's actually that's
actually good very very funny brake
lever god this is a bad algorithm we're
looping along all I yeah it's it's a way
to do it after line 17 please insert
result oh boy here we go
result a B is gonna be equal to a result
plus not be binary and 1 times B B and a
plus B
well let me comment all this over here
so that was ember axe so the the the
binary end or the logical and of one is
interesting so
times be interesting I often have to
like write out like binary operations on
paper in order to actually see what's
going on a lot of the time
binary ending of one will only so if
that's like if it was like two and and
one it would still be two but if it was
like three and binary and of one it
would be two
or is that right and I'm a my I think I
might have that backwards thing it might
be the opposite of that I think it might
be you need one in order for it to
actually work and practice submit so M
this is M praxis code right here so it's
actually aa BTech who's up next how
about you just run it and see what
happens well I can tell you right now
based on what the linter looks like it's
gonna crash so if I if we write Python
script to whoops
script to PI it's just gonna give us a
syntax error invalid syntax and we can
actually see that here and I actually
have a linter installed so you can sort
of hover over any of the we can hover
over any of the red underlined areas and
see that that's what syntax error that
is
Dick's fireboxes oh wow live game smtp
waiting for my chance hope you've been
added reacted yep I'll be tech 18 can
you just fix the function because I
cannot see the red lines just make it
next fib n where n is the input whose
Fibonacci numbers found sure next fib
and so that fixed the sort of first set
of syntax issues and I'll go ahead and
add this as an amendment to courtesy of
a BTech and so rule CS it is now your
turn again
can someone explain the not be and one
be to me I don't see it being helpful
line 22 is number n that's the whole
point though people are people are going
to contribute their lines of code and
it's up to sort of the chat to figure
out what's going on and to correct
people if need be
so ah be tech 18 and bail occurs so rule
says return result okay I can assume
that we want that to be like here so
rule nice to see everyone on stream
today says David J Malan so shows the
David who's in the chat making an
appearance maybe if we're lucky David
will pitch a line to the to the chat
here or to the script here if we're
really lucky on the same indent as the
four okay so here like that Oh on the
same indent level as the four so like
this do you want it here or do you want
it you want it in inside the for-loop or
at the same indentation level as the
four loops a rule install plugin for a
ripple that's scale code in real time
I'm not sure what that is graph Snickers
22
oh I see an Evo but could be good
this won't I mean we wouldn't even work
right now because it's broken so for the
for the sake of that would only work as
theoretically if our code was actually
fixed which is not
vinícius got good words for for david
about taking cs50 through the Harvard
Extension school okay same indentation
level as the for loop okay cool we got a
lot of chat and they've got a lot of
people in the chat so if anybody's new
if anybody doesn't know if you want to
contribute lines of code to the chat you
need to put in three mister destruction
robots and that will signify to me that
you want to participate so sir rule
participated I'm going to go ahead and
add their name here and unknown boy a K
or uh none boy yak it is now your turn
let's see what you have next
remove if statements and add so unknown
boy hack we we do not we are not gonna
add that much code you can only take one
line that is a lot of code and we don't
also we also are not allowing removal of
people's programming so you can propose
an amendment eat on someone else's line
or you can propose a new line somewhere
but you cannot delete lines and you
cannot propose multiple lines that would
be unfair
sorry about that
I don't bow ACK still waiting on you for
your single line of code
we don't have any raise right now in
case anyone is wondering yeah that's a
good observation that's true we don't
right now we essentially just have a
generator expression and a lot of if
statements and a lot of red squiggly
lines which should maybe signify that
some amendments are in the books in the
cards in the works but uh uh none boy
act we will wait just a few more seconds
if you want to contribute your line and
then we will move on to bruh but I is
this a bit too wrong to fix with just
one line amendments anything is possible
with just the one line amendments and
Python using Python syntax can you nqm
Brax please oh did it out in queue you
oh my apologies
mBLAQ's you were added back to the list
that I missed anybody else by chance I
did miss ember X that was my bad I
apologize
unknown I'm not gonna test your code I'm
gonna add your line one at a time if you
want to make an amendment you can
propose an amendment if you want to add
you can test your code as by getting a
Python interpreter on your machine and
testing it which is very easy to do
Chopra q21 wants to be added absolutely
can you modify my code from not bn1 to
not be and what I cannot do that in Brax
unfortunately your tie your turn is
passed
you can certainly when it's your turn
again propose an amendment or somebody
else can propose an amendment send box
of cs50 dot IO handles Python you should
handle Python it's not shareable so it's
only instance for you and it looks like
new nine I'll super also gave a online
interpreter which is nice and we are
using three point six actually I might
be using three seven let's see three
seven three so pretty close to cutting
at the bleeding edge but not quite three
point eight I don't know if they have a
three point eight alpha out just yet
that in line assignment thing is pretty
cool I don't you I wouldn't use it a ton
but it's a nice feature the three point
seven the data classes stuff I didn't
really look too much at oh it's also
yeah here on the bottom left Python
three seven three because I have a
linter enabled actually it's using my
three point seven three Python schambach
sandbox is shareable but it's not
real-time shareable like you can share
it and then as soon as you make changes
there the person's not gonna see them
I'll let the sandbox or the the IDE was
the way which you could actually share
your workspace in real time with
somebody so that's what I meant
it's shareable in the sense that you can
instance this instance of sandbox but
not real-time collaborate in a sandbox
I do not have an idea for the code in
one line that's okay that's the point if
you want a nun boy yak we can uh we can
put you at the end we can skip you and
come back to you and we can go to brew
bataille it's been a few minutes but
yeah like true candy said you can also
just take part of what you propose and
execute that one part not be flips all
the B yeah
yeah to understand the the logical and
that M Brax used it's you'd have to
write it out on paper and sort of
compare like ending B with one which
would be zero zero zero zero zero zero
one and then doing an and operation on
that well on another number so let's say
two two and one would be three because
the sorry that would be no that would be
or to end one would actually be zero
because and is basically making sure
that both of them are 1 so if both are 1
if you're looking at the binary on top
of it if like if you're looking at the
string 1 and then 2 then that would be
that would be essentially 1 0 & 0 1 and
since they don't have overlapping ones
right it's 1 0 & 0 1 the end that would
be an or operation to get 1 but you just
essentially and both of those so take
your basically with am looking for 1 & 1
and since none of those have a one on
top of another one that all equals zero
essentially and then but if you had for
example if you're doing 3 & 1 which
would be 1 1 & 0 1 then your end result
of that would be 1 so & 3 & and 1 binary
and would be 1 that's how you calculate
that's how you calculate logical and and
then not would flip that
Robinson M 232 wants to be added to the
stream
okay so another boy AK is gonna skip bro
but I it is now your turn what do you
propose for this amazing Fibonacci some
algorithm that we are building in Python
line 22 result plus equals I so within
this if statement here within the like
is it going to go inside this if
statement or inside this if statement
which the current line 22 21 to 22 okay
so do that and then inside here we're
going to do result plus equals I okay
and that is rubber ties contribution
cool Coulomb poor us it's your turn
oh right yeah logical and any number
with one yeah because everything is all
the zeros are those are never gonna be
evaluated to a one because of the way
and work so yeah the logical and
essentially in that case does give you
fine it's great did I always okay there
we go sorry X premix official you wrote
I not one one not I yeah I know
I always messed that up but yeah that
although 0 since there's never gonna be
evaluated to a 1 they it's essentially
just an even test yeah exactly it's a
very clever even test
if there's more code under the pass and
isn't run right I believe so
wait is that true I'm actually not a
hundred percent sure
oh it's just a no op eration but I don't
know I don't I don't think it works like
continue I think pass will just
I think pass will still go on to the
next it'll still go on to the next part
of the code right
yeah it still it still just goes on to
the next letter or in this example so
yeah pass isn't a pass isn't the same
thing as a continue it is a just a
little empty statement as a placeholder
so real Santos wants to be added back
into the code and then column for us it
was your turn is : porous so present and
accounted for su rule and added you back
to the bottom of the roster so : porous
we are waiting for you oh sorry
colo is gone mu 9 is your turn now moon
on is asking and how would you know
liffe I an if statement
you can put continue inside of for loop
to skip the rest of body just like the
if statements execute initialize I is
equal to 0 for line 17 says M Brax
going to try to cancel the first if
statement so this this are this one
cancel the first if statement so how are
we gonna do that
can you edit line 20 to have the
condition if false before it line 20
sure can
so that would be these two indented in
and that'll be mood 9 DM SMTP it is your
turn
interesting way of sort of circumventing
code that we might not necessarily want
present in the script moon highness is
praying that the next to do the same for
the next two if statements not a fan of
the two if statements I mean I think
they're still technically syntactically
invalid so somebody needs to fix that
before the script will even run
as far 404 got you involved in there so
i DM smtp it is your turn so if you are
present let us hear the line of code
that you would like to add
after line 14 I is equal to a plus B
sure
oh whoops did I
DM SMTP alright
puppet 4411 your turn now let's see
let's see what you got
we need to pass in the body 123 to
change number two I and a pass inside
the if statement on line 24 that would
be that would probably be helpful line
20 amendment not be oh okay there we go
not be and I like so nice that should
fix the current bug we're not is taking
precedence over the and operator so
shoutouts to puppet 44 11 I'm gonna add
that as an amendment actually well I'm
still thinking about that
and we'll do amendment puppet 44 11 it'd
be cool if there was a way to better
sort of mark out who amended what at a
particular place cuz right now it's kind
of like if multiple people are men the
same line it's kind of hard to see who
amended what but you know it's okay
DMS and TP wants to be added back to the
end oh did I miss as 41 moon 9 and mist
moon 9 and let's get DM SMTP cool
I think an takes precedence over not I
am actually not sure because I need to I
would need to test myself because I
don't remember the whether the binary
operators take place first I see that
while I'm not here I'm still president
spirit line 22 yep absolutely true Andre
people are onto your technique yeah and
I it vaguely sounds familiar that and
the binary the logical operators or the
binary operators take precedent higher
precedence and pretty much everything
else so except for obviously parentheses
so that makes that make sense
loner kington line 25 at if false and
indent the next two lines line 25 if
false ended the next two lines we can
only indent the immediate block so we
cannot indent more than one block so we
will just indent that one loner King 10
and I'm actually frankly not sure if we
should even allow indenting like in like
implicit indentation of lions like I
almost feel like we should have the
indentation step be something that is
like somebody needs to specifically
request an indentation because that
would make things a little bit more a
little bit more granular in terms of the
chat like people would have I think a
little bit more flexibility and in terms
of a lot more flexibility but they would
have more they'd be a little bit more
room for chaos and so people would have
more of a shot at fixing things I think
but it would also take more time so
we're kind of taking pros and cons with
these approaches not as higher
precedence and C C++ and Java Python
oops in a clue but I hope it behaves the
same way are we allowed to insert I
cannot see what that
Oh for the comment blocks no we you
cannot comment things out loner King Tim
that was loner King Tain's contribution
which I put in there so it's so
hazardous turn so has aura is your turn
now and loner kington wants to be added
back at the bottom
well have we already been going for an
hour and a half are you serious
Linux ninety-four hello
thanks to trucha nice for kindly writing
the instructions as people join in the
chat making it clear how the flow of
this experiment / operation goes delete
line 27 so as our we are not supporting
deleting lines you are going to have to
propose an amendment or a new line oh
the amendment wasn't needed says puppet
oof that's rough but at least it's
explicit there's a there's something to
be said about explicit parentheses
parentheses right to be honest right now
we know what we need to do but we need
to waste turns deleting incorrect code
true that's part of the fun number needs
to be initialized people says ember acts
so Huzoor oh it's true key nice right oh
yeah so Azure we we're gonna need a line
we're gonna need a valid suggestion from
you so do you want an amendment do you
want to add a new line of code what is
your proposal salt Eric we've got you I
remember your super smash brothers
project that you showed us on the twitch
code review another code review tomorrow
everybody by the way if you want to if
you want to tuned for that with David
David will be doing a awesome code
review so go to cs50 dot ly / code
review to participate in that
print I underlined 26 says so huzoor all
right
print I courtesy of so huzoor cool so
that I think fixed a little bit more
syntax got a few less squiggly lines
fewer squiggly lines so trucha nice it
is up to you
let's see what you got official podcast
news when we're announcing it soon but
if folks want to watch it's on Spotify
Apple right now and all kinds of other
it's on Google podcasts Spotify iTunes
SoundCloud YouTube I think it's gonna be
on Facebook and I think there was one
other platform I can't remember I'll top
my head it's on all those platforms cs50
podcast episode one so go ahead and take
a listen to that it interested number
equals zero on line 20 so spooky nice
will do here number equals zero
that was the truká nice beautiful RJ s
NK e 5501 sorry it is your turn let's
see what you got what is the code review
URL true Kenny's kindly plug that cs50
that ly / code review here we go
I is equal to that looks like a troll
line maybe me I'm gonna guess the troll
line so after line 22 I is equal to 1 2
3 4 5 I minus I divided by 2
plus one divided by I times two
double divide I times I plus 0.001 / I
crazy line I'm guessing that is going to
blow up my computer this will be
courtesy of RJ SNK five oh one who's
been patiently waiting to add that to
the to the stream I can imagine
trucha knees and Andrei want to get
added I can certainly do that cool it is
now a pink sixes turn to add their code
to the script poor little end in the
function argument yeah and it's not
being used for anything which is okay I
mean that's part of the fun right it
Peaks six I'm gonna be sure four pink
six is still tuning in I haven't seen a
single comment from a pink six in a long
time then ec patiently waiting Vinnie
are you are you added I don't think
you're added to the list if you want to
be added to the list throw some robots
in there oh you're referring to when I
said patiently waiting are Jess and K
yes yeah I'm done that's my only
contribution well we have our first
troll this does not look wholesome
but that's okay
apink six line 16 LST equals empty list
cool so we have a list a pink six dance
trainer your turn
being actually evaluated as equals I
plus 0.01 divided by I pretty flinch
this is very easy to mitigate I see can
a bot filter chats only line Xcode gets
through
I think a bot can do pretty much
anything related to the chat hmm I don't
know if I'd want to filter everything
out I think I would minimally like to
have a bot
yeah bot gets dream if it wanted I think
a bot would be cool to like create a
queue for people to put their name in
and then just output the current person
and remind them so that somebody a human
doesn't have to do it but I'm not sure
what else I'm gonna skip my term because
too much for me says dance trainer okay
that's totally fine I'll be tech 18 it
is your turn let's see let's see how
you're gonna take this one home for us
and then after that it'll be Bella cures
his turn this one's proven to be a
slightly more complex check codes cubot
I debate I thought about that honestly
because I was reading the API
documentation before the stream begin
just to kind of help this flow a little
bit and didn't obviously have time
before the stream to do it but I thought
about it it's not about adding that
making a bot that would actually take
the lines of code and put them into a
script on my machine because I could run
the script on my server here and
actually have the results from the
script go into a Python file that we
could see updating in real time but I
would need to write a way to parse
people's comments to actually put the
code in the right place that would get
chaotic and also I'd be slightly worried
about like multi-threaded conflicts like
I don't know the exact I know note is
single threaded but I'm because they
would need to open right to the file and
close the file and these would be
happening asynchronously I'm not sure
how it would work if it would be if it
would be
tricky or not something a good way to
get OS remove I wouldn't run the script
I would just pipe it to a file and then
but yes you're right it would be a good
way to get OS remove we would
essentially take input from people for
like five minutes look at it run it look
at it run it and so on and so forth
and we could maybe sandbox it to like
actually run it in a VM or a docker
container or something and then have
that actually be running the script and
executing and give the script limited
act limited read/write access to the
file system so that it couldn't actually
remove anything that would probably work
a bit but I'm not a hundred percent sure
okay thanks Facebook has been having
issues today they've been breaking off
I'm probably not gonna rerun it but
definitely apologize if you're coming
from Facebook I'm not sure what's going
on today
something is behaving really weirdly
today we'll figure it out what will fix
it dance trainer adds you to the end of
the script here
[Music]
a BTech says line 20 amendment instead
of range for million changes to range n
interesting so a BTech 18 says in the
range of n ok cool bell occurs it is
your turn now not all heroes know what
they have done at the moment I'm very
curious to see where this goes now yeah
you would need to sanitize that yeah I
web solutely would well what would do it
would it would just be taking input from
twitch chat and piped to a file type to
just a Python Python file so because
it's being piped using probably like FS
right to a particular file using the
message it would just be writing the
bytes from that message to a file so
there's not really any malicious code
there it would really be involved in the
running of the code like the running of
the Python file which in which case we
would look at it in advance and if we
sandboxed it that would we would be able
to run it a little bit more freely if it
were sandboxed or you know yeah just
sandbox but if it weren't I would need
to look at it read it read over it in
advance before we actually run it make
sure it doesn't do anything malicious
with all kinds of people honestly it
would be impressive to stage anything
remotely close to a like compromise of a
system with so many people all writing
stuff to a file right it would be chaos
Billick here is line 34 next fib num if
it's correct okay
next fib
all right Meg I wrote next to fit bum
fib num next fib num okay
that's belly Cure's cool em Brax you're
up up to bat again I'll be texting bye
guys that's it from my side can't take
anymore it's a great time with you guys
bye alright thanks happy thanks for
tuning in appreciate it
puppet 4411 you forgot the N Boop's
[Music]
ember axe it is your turn it is on you
change the for-loop to something we will
shortly find out while b is less than or
equal to 4 million okay okay this for
loop so while while B is less than or
equal to 4 million okay cool thank you
for the contribution choke Oh kid you're
now up how much to leave is the chat
half for you I'm not sure I think I'm
twitched you think it's about like 10 to
15 seconds so not too bad on mobile oh
that's ok I'm back what has been done
well this is the script so far choko kid
so there is a your comment is still here
of course the most important part of the
script change this change the comment
that says Choka kid was here too a print
we are disallowing the
amendment of comments but if it's to a
legal statement and we're just making it
a print I'll accept that I'll accept
that we can turn comments into print
statements that's fine and I'll just
make that a string choko kid 21 thank
you for your amazing contribution choko
kid it is next level
okay Robin some 232 realize I should
have put my line before line 23 oh yeah
probably the choko kid 21 squared I
actually don't know how to write it
would be this
that's TM will do the choker kid 21
trademarked I don't know how to do I
don't know how to do superscript two can
you add my amendment on line 21 instead
of number equals zero okay which is here
change it to number equals a plus B and
if possible number equals zero on line
18 well we can't do number equals you're
on line 18 but I can change your
amendment to number equals a plus B
so we'll do something like that and then
an amendment on the behalf of Robinson
m2 32
alt gr and two
wait altgr and - wait what does gr alt
gr and - because I'm doing alt - I'm not
sure it all gr - is
but anyway sir rule CS it is your turn
next all gr key
wait
oh right alt interesting this would be a
new thing for me to know if this is it
that's the case it's actually pretty
cool let's try it
choke a kid nope for me it's still it's
still squared or it's still TM so I
don't think that applies to Mac's
Cyril CS line 36 print next fib num of 1
okay so he wants to do an amendment okay
so an amendment so rule cs of next fib
num of 1 okay cool as far 404 your turn
next
Bell occurs must be added back to the
end stay peaceful hello good to see you
yeah true candies the it was the
superscript 2 so the like exponentiation
to like the small - up to the right for
me if I do write alt + 2 on my keyboard
it does not work
ember axe as in cue me please yeah
exactly like what choker kid just did -
2 - as far 404 we're waiting on you for
the next contribution so if you would
like to contribute when you decide to
run the code because the thing is
complete isn't it it is still broken so
if we run it now we still get a syntax
error on line 34 with return result and
the reason for that I will leave up to
the twitch chat to determine but there
is an error in the code currently
preventing it from running oh sorry sir
rule I totally missed that my apologies
so as far as thinking about the next
line to be added to the the last if says
RJ SNK 501 it might be on to something
maybe put a no op or something totally
valid way of approaching the problem
after line 31 if false okay so I'm
assuming you mean here if false like
this and then it to indent this block of
code here am I correct in that
interpretation as far I have to go afk
you can remove my name and add your name
Colton says puppet 44 11 sure all that
in my name why not that's true I have
not contributed yet okay cool so I was
correct now that did not solve the
syntax issue so that is still present we
can see there are red squiggly lines
around this area here so as far four oh
four I'm going to add your name to that
line and hopefully mu9 maybe you know a
way in which we could fix this problem
you have a numpad I do not have a numpad
on this keyboard three seemingly
disjoint if falses yes three separate
ones who do an if false and indent the
block below it and one move correct II
the block um not an entire block you can
well I guess a block yeah I guess
technically speaking a block yes and I'm
debating whether we can whether we're
gonna take that out and make indentation
a specific step I might I might do that
just because that that would be that's
kind of rough honestly I think for the
next time we do this we might do we
might be able to let people say the if
false thing and then how people
separately say indent line X
after line 11 put if false and indent
the entire block immediately below it I
entrust the making of a solution
function function which simply outputs
461 373 to the solution to my successor
so we're gonna say if false courtesy of
oh I need to have this here and then
this goes to MU 9 and then this all
needs to be indented like this all right
you can thank mu 9 for that one
everybody DM SMTP it is your turn
Cho ko kid wants to be added no we can
start again now we can start again
realize that people can amend your line
Cho ko kid JP guy wants to be added in
there the JP guy diem SMTP wants to be
skipped it is my turn I am going to
amend this line to say if true cool so
now we're back to where we were and DM
SMTP
good timing on that right a loner
kington it is now your it is now your
turn a bold move let's see if it pays
off yeah we'll see if it pays off diem
SMTP jpg I got you cool I guess I'll
have myself to the end it's kind of nice
playing being involved as far 404 bovine
move what's the progress so far we're
close I think we have all this code
there's a bunch of yellow yellow stuff
undefined variables which is okay that's
pretty normal I think it's weird this
triggering that is undefined because
this is this is we are defining them
here in one step so I'm not entirely
sure if from 90% of 0% than 90% you kind
of did loner kington it is your turn so
where where would you like to take us on
this fine day maybe reload the pilant
extension that's true there's also an
error here which is breaking the script
and I'm curious if that fixes it this is
one of the strangest things I've seen in
programming I love it it's it's cool
it's a fun community experiment we have
different directions we can take it to
keep your code as a sacrifice I love it
someone fixed the error
enjoying Python for the first time fun
thanks cs50 absolutely thanks for
contributing and being part of this this
is how you learn
don't make me join the queue again
please is RJ RJ is desperate he wants to
they are he or she's desperate they
wanted this to be fixed sorry I can I be
moved to the back of the queue
absolutely
but loader kington are you present and
accounted for
I'm suspecting possibly not I don't
think we've heard from you in a little
bit
I'm gonna build about five to ten
minutes okay that's fine sir rule CS
let's add you absolutely by the way I'm
using this Noctis color theme I've been
enjoying it quite a bit I was I looked
at a tutorial or not tutorial a an
article which showed like some new good
themes for vs code so if you're
interested noctus is pretty cool I've
been getting a little bit tired of one
dark which I've been using for a long
time also the Dracula theme is pretty
cool I will say moon I'm I will add you
moon I'm just gonna amendment the line
again and change it back to if false
alright lunar kington you're off Erik
let's get you in there for the first
time in a CL Erik what do you have to
say what do you have to contribute to
this amazing codebase how are you gonna
take us home looks like Solarize dark a
little bit it's got slightly different
colors it's got a little bit more pink
and purple than solarized dark does
it's also got a bit more of a blue tinge
to the background but yeah it's it's
similar it has a lot of orange just like
Solarize dark does like the function the
DEF is pretty orange e this one's not
Dracula this one's Noctis Dracula is
cool though
I actually I don't have it installed on
this account but if I install it you can
see this is what Dracula looks like it's
kind of nice it's it's more purpley i I
think it's okay I personally prefer and
knocked us a little bit more Grove box
and Falcon
oh yeah it's a little washed out for me
but I could see it's not bad yeah Falcon
which one is is it the custom COBOL -
I'm not sure which one it is
widescreen keeps my eyes fry it and
alert ooh a band this man's a pika city
lights and Andromeda are nice
oh it's not bad I actually like that one
quite a bit
this one's pretty good too yeah both of
those are pretty good I think I still
like knocked us a little bit better but
the the first one the city lights
actually it was pretty good I could see
myself using city lights let's go back
to noctus yeah like noctus lux like ooh
ouch blinds me
minimus I was also a debating noctis
minimus like minimus is pretty good but
I think I like regular Noctis a little
moral for how much more vibrant the
words are yeah
good suggestions sorry we got a little
bit off-track there NaCl Eric
so did NaCl Eric end up contributing
line 23 break okay excellent line 23 9
23 break thanks Eric it's a great
contribution I'm very proud to have you
as part of this stream the chat thanks
you for your contributions
trucha nice it is now your turn
9:23 amend pass ah ok ok I see nice well
done
trucha nice
we will eventually get this to work
dance trainer it's your turn now there's
a sarcasm thanks for your contributions
outplayed see if we can get a hundred
lines of code we're getting there we're
actually now we're not getting there it
felt it felt like we were getting there
but we only actually have like 30 actual
lines of code less then I don't quite
see where the bug is to be honest is it
a tab thing if you have a I won't say
anything dance trainer let's see if any
underlines a code it is on you now dance
trainer
noctus minimus has that aesthetic says
mu9 that aesthetic things also - I have
not been keeping up with this whatsoever
but so you get asked for four for blacks
no Emily slap Gray's ID rich Linux 94
Tom walking pants and real end skill 99
a reelin skill putting up after the last
if to fix the problem if only someone
give us a chance to start over without
any bugs to the moon 9 yeah well you get
yours in time the night you'll get yours
in time I think a machine learning
algorithm would be faster than touch
chat that's the meme though right and
that's why it's fun so it's fun to watch
dance trainer let's go let's get you
let's get your submission JP I just
saved it well I saved it earlier but
here's another save and it still has the
still has this issue I can read I can
rerun it though or I'll just I'll quit
it and then re rerun it so if we go here
bring this over to vs code
and then still there unfortunately can
you scroll up yep we're up here this is
basically where the script stars well
yeah basically it starts right here did
the first if false break our variable
initialization well it's an if true now
I have to invalidate the cash and
pycharm all the time for some reason
does your code support Unicode print
statements it should yeah
who would have a sandbox snapshot to see
the current version yeah I'd have to
create a sandbox snapshot for that so a
is equal to 1 B is equal to 2 I is equal
to 3 before stuff goes down yeah
essentially essentially yes that is the
case that is indeed the case
and be the change you want to see in the
world I love that that's funny and
talking a dance trainer pressure is on
to fix the to fix the syntax bugs
I'd have to copy the code to help out
properly first I'm a contribution until
then won't be much someone fix line 38
yeah interesting to figure out a way to
get everyone to see the code at the same
time sandbox would work but it wouldn't
update in real time
IAB equals a + b bi interesting right
under the wild statement so right here
so i a b is equal to a plus b b i for
virtue of dance trainer nice so like
basically mixing up our variables
it's beautiful very well done bill the
cure is your turn next what do we got
from Bella
it essentially goes to the next number
in the sequence let's run the code Bella
it's gonna crash so if we do this see we
still have an error on line 40 where it
says return result right here so we have
a expected indented block error and
expected indented block error
continuously cat the contents of some
file that gets hosted on the Internet
yeah I could do that that's true yeah we
just need to check if it's even and add
it to the sum first this code works you
should add it to your portfolio to
impress all those Google software
architects yeah probably probably we
could all get jobs together with all all
collaborators together on this RJ's RJ's
gonna our J's are just mad I'll fix the
if statement than an orc face maybe
somebody will get to it before you I
mean I'm in there before you so we'll
see
no Lex dead beef line 40 fix the
indentation what do you mean
Bella
just to be clear the error starts not
necessarily here notice there's a
squiggly line up here as well but I will
do what you tell me to do and then they
want a terrible idea
I've made it my life's mission to make
this code work I won't sleep or eat
before it happens at the end of this
actually wonder if anyone will be able
to figure out what this code is doing
since the rule do it
line 39 pass ah there we go
that might that might be something
helpful now what happens if we run the
code unsupported operand types for and
float and int interesting B is a float
in that case oh because of weight that
because of this right
is be not a be just an int right he's
gonna start at zero but then get turned
into I which is zero still is it III a B
so I is gonna be a plus B huh
interesting
bell occurs thank you for your
contribution mBLAQ's line 30 makes it a
float line 30 does make it a float but
oh because we're iterating over it right
yeah I guess that makes sense
true true true miss my boat's Colton hey
what do you mean mr. BOTS
oh shoot I did
sorry I missed dance trainers as well
huh
shame on me the chat moved so fast that
I I'm in stit which is a good thing I'm
happy that people are chatting okay so M
Brax IAB equals IAB line 23 amend okay
IAB ia
me and what a beautiful meaningful line
of code this is chat move so fast nobody
will notice that I don't study computer
science this is JP yeah now run the code
says M Brax sure four six one three
seven three two wow that actually worked
really
Wow okay I was not I was not expecting
it to be honest I guess
I guess because I isn't really being
used for anything so result is just
gonna yeah results is just gonna be
calculated from this then returned and
the N doesn't mean anything so it
doesn't matter that we're passing in one
we could pass in any number and we're
going less than or equal to four million
and it just works well done very well
done everybody we accomplished two Euler
Euler soy oil er challenges today wow
that was great
nice confidence boost I honestly I
started focusing more on the chat and
more on what people were contributing
and less on the flow of the program as
we got farther and farther in but now
that I'm reading back over it it
actually it makes sense it's cool and
there's a lot of things in there that
are kind of like diversions
I lost all confidence on you of an hour
I mean I didn't lose all confidence but
I thought that there were a couple of
things in here that were going going to
cause issues I I lost sight of the fact
that n was meaningless and so I thought
that that was still a problem we had to
solve and this I didn't realize this I
was completely removed from this
operation and yeah I thought this was
something we were gonna have to deal
with but it turns out we did not and so
now it all makes sense is actually we
were very close this whole time a
one-liner in 30 lines yeah that's true
can you check line by line what's wrong
what's wrong what's right what's right
is this basically this line is doing
everything every iteration it's
basically it's basically adding the
result of the last two or it's adding
two basically taking the last two and
adding result to it if it's even and
it's calculating whether it's even with
this and on one
so if and on one is true then that means
it's an odd number so that's why we're
taking not of that to test for even
numbers and if it's even we're going to
multiply that which is gonna be 1 times
B actually is that right and on is that
correct I think that's correct
but essentially we're knotting that to
make that a 1 if it's even and then
we're time using that by B which means
that's whatever the last number is and
then we are essentially just doing the a
plus B it B assignment here so a is
getting the value of whatever B was and
B is getting an assign the value of a
plus B so the last two numbers and so
that's what's happening in this loop
won't be is less than or equal to 4
million and we're skipping in blocks
this way of numbers we're not actually
iterating from one to four million like
we're originally gonna do which is gonna
be that a bit more work the classic
programming meme where the code doesn't
work you don't know why and if the code
does work you're still not sure why yeah
no I am sure why but I had for some
reason thought that we had a few more
problems to solve than we did so when it
happened it was a pleasant surprise to
me it was very nice
can we do 495 next what is programming
number 495 let's see archives I do like
these project or problems though I think
they're very interesting
okay let w of NK be the number of ways
in which n can be written as the product
of K distinct positive integers okay oh
I see
interesting for example W of 144 4 is 7
ah
fascinating okay this is cool there are
seven ways which 144 can be written as a
product of four distinct positive
integers so it's kind of like finding
the factors of something but not the
prime factors and not the yeah this is
like even factors
and their distinct positive integers
note that permutations of the integers
themselves are not considered distinct
right so like 3 times 1 times 4 times 12
is not different than 1 times 3 times 4
times 12 furthermore W of 100 factorial
10 modulo 1 million seven is equal due
to weight 287 million five hundred forty
nine thousand two hundred weight what
does that mean
find w of 10,000 mod factorial 30 modulo
1 million and 7 the exclamation points
referring to factorial right in this
case or is that different syntax for
this problem it will take 2 hours and 49
unused lines and it'll be glorious oh
this has the fewest solutions on all of
project Euler oh goodness
yeah this would probably take us a long
time we will how many solutions does it
have 195 Wow
difficulty rating a hundred percent yeah
it does not sound easy but it's cool
yeah this will be I think this will be
the time where we end it for today we
did it for two hours we did we solve two
project Euler problems I thought that
was fun
it was a cool way to test things out
I'll investigate and see what's feasible
in terms of at which spot that we can
end up actually having this work
apologize to anybody who is watching on
YouTube and Facebook earlier and it saw
that glitch out it was having some weird
bugs I'm not sure why so we'll
investigate that see what was up with
that hopefully we can get that working
just fine by tomorrow so FYI tomorrow we
are streaming - we are streaming with
David Aames gonna be doing a twitch
review so a twitch code review so if you
aren't if you haven't submitted a piece
of code to us to be reviewed go to cs50
ly slash code review we'll take a look
at your code David's gonna take the lead
on that and yeah should be good time we
haven't done a code review in a little
while tomorrow is that next week nick is
gonna be doing a part three of the
neural network stream or we're gonna be
doing a style transfer operation on our
page on our pictures so we're gonna take
existing pictures modify them make them
look like artwork of some kind or
whatever he ends up deciding and then on
Thursday ostensibly we'll do another one
of these but with maybe a twitch bot and
we'll see what we can get going with
that
Charlie sure so I just hit the local
recording to spice this back in for the
final YouTube cut but this is the end of
the stream unfortunately but having some
technical difficulties let me switch
back to obeah so you can see that
everything is currently at the right
view oh right
before I do that before I switch to the
final view let me just publish this to
github as the twitch chat codes Python
to stream so give me just a second if
anybody has any questions while we wrap
up here feel free to toss them in the
twitch chat I'm taking a look at it I
can see it right now chat codes Python
to put stream coded by chance solving
boiler problems so we have public repo
great repository and then do this and
then get in it give that all git commit
cool so that should be pushed up now
cool so if you go to Tesla Lorex with
the sad cat face Bellus is thinking for
the stream Colton thank you for tuning
in Bella I'm glad we got you in this
time if you want to oh nice trucha nice
beat me to it
but a code review will be going for
tomorrow from 2:30 to 4:00 so 2:30 to
4:00 tomorrow with David there will be a
code review session so submit your code
to cs50 ly / code review and we'll take
a look at that also join our discord
channel so we do have a discord to cs50
discord so I can toss that link in the
chat as well figure out where that is
yes we do discord and we'll be actually
looking at that live so if you are on
discord or not on discord yet actually
and you would like to get invited sure
can you beat me to it again if you want
to submit code live then submit code to
the live code I can't type code review
channel there in the discord Channel and
I'll be looking at that while the stream
is going on and assuming that your code
is legitimate and you're not trying to
troll us you know I'll go ahead and I'll
submit that for a live code review and
even if you are trying to troll and it's
still you know a good example maybe
people still accept it but I think
tomorrow is gonna be a little bit more
of a serious stream on the actual code
review stuff so definitely submit that
will be eager to read your code and see
what you got see what's good what's bad
you know David we'll be we'll be looking
at it Adam says troll question mark we
got some trolls Adam we got some trolls
but it's all good it's all in good humor
so yeah definitely definitely tune into
that be a part of that we want to get
we're all about the keeping things
serious here this is our J yeah I don't
know I don't know about that Funston
anything exactly yeah
so thanks so much everybody this was
cs50 live this was our chat codes Python
number two we'll do another one next
week along with a neural networks part
three and we'll see if maybe we've got
something else lined up
for Friday but thanks so much again this
is cs50 live stay safe
see you again soon