Placeholder Image

字幕表 動画を再生する

  • all right, Tell the world this is CS 50 Live.

  • My name is Colton.

  • Ogden sees 50 unfamiliar for watching this on YouTube on twitch on Facebook and you're not familiar with CS 50 seats.

  • 50 Is Harvard's Injured, a computer science stop by David Malin.

  • My name is Colton Ogden.

  • This is an offshoot of that, and this is sort of a live interactive Siri's 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 coating for me.

  • I'm sort of acting as a proxy.

  • And so what the sort of system is that we have in place now is, and I'm just gonna go over and, uh, 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 of unfamiliar with twitch that are very common on twitch and sort of ah, hallmarks of the platform.

  • One of them is the Mr Destructor 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 on DSO 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 is named 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 tea and so has or 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 chaos sort of run, which is 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 run Herbal.

  • And we finally got that run herbal and it was It was crazy.

  • It was Mihm's all over the place.

  • But then we finally got after that to a more goal oriented project where we actually implemented in asking Square.

  • And that was cool because we had the sort of witness is the assumption that some people are going to take it seriously and some people are not gonna take it seriously.

  • And that's why it's entertaining.

  • Um, and I get to sort of sit back, sort of referee the situation, but, like, kind of enjoy the process.

  • And it's funny to see people take the sort of the troll sort of submissions.

  • You know, where it's obvious that they're tryingto kind of steer the project away from completion for the sake of good intended humor, of course.

  • But then to see, like other people who want to see the project completed, actually amend lines or add lines in order Thio make those lines not work in the project.

  • And so you kind of get to experiment with what you're capable of and python 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 gonna go ahead and write them in.

  • So the Choco kid 21 we have and I apologize if I type of your screen name.

  • Some of these are a little bit tricky.

  • Colin.

  • Poor Ross, Uh, for us.

  • And what of zero and can Ah, Zhu, are we gonna be able to comment outlines in the 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 going to 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, air 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 No, no 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 else's line, you can propose an amendment.

  • So make sure you specify your amendment, specify your line and, um, no commenting up.

  • And I think that's roughly all the rules that we decided on that we would take this time.

  • Just that we make sure everybody's work gets sort of equally valid sort of cryonic credence.

  • But consideration?

  • Uh, cool.

  • We just make sure meeting the chat.

  • Some folks are potentially saying this.

  • Problems with Stream.

  • I know Facebook is having some issues today, for some reason.

  • Hopefully, if you're on watching on Facebook and it's having issues, go to twitch twitch dot tv Sisy SVT TV so that you can participate in the in the chat and actually be part of the part of experiments, because this is a particularly bi directional day because a lot of 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 will answer questions.

  • But it's not nearly as bi directional est today streams air work by.

  • You're literally writing everything that goes on in the script today.

  • And, uh, 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 baht, if not the entire script writing process.

  • But I have to take a lot of 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 to as possible and streamlined as I'd like it to be for this channel.

  • How do you use procedures and functions?

  • Uh, you would just do right, a function like deaf, some function, which could take in some argument.

  • And then you would say, you know, some function called some other function call right.

  • This would be a function, and, uh, this is would be the definition, This would be the body of the function.

  • So what is the goals?

  • That's interesting, because good question, True Guineas.

  • The goal today, I think what we would do.

  • Some people actually propose Project Oiler last time.

  • And I think Brian actually in a prior stream, uh, suggested Project Oiler was one of 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 Stream unless you want a 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 is fighting for.

  • We had this tension between, you know, people that wanted to prolong the stream, people that wanted Thio, people that wanted to actually solve the problem.

  • So and then wolves, I will add you as well.

  • So But if there is overwhelming consensus, that chaos is what we want to dio, especially if we have a lot of people that didn't that weren't here for the first time.

  • We did the stream, then, uh, I'm certainly open to that.

  • I ultimately want this to be entertaining for everybody.

  • So So how's your?

  • The goal of the goal was to essentially make a, uh, make a box that looks like this, you know, but actually square.

  • But to actually have this be, like an input from the user of the user input, like five.

  • And it would draw a five by five square.

  • So it was a pretty simple goal.

  • We were gonna do Mario eventually, but people proposed that that might, you know, be against academic dishonesty guidelines, which is completely valid.

  • So we will we'll stay away from anything.

  • CS 50 problems that related and just do custom problems here with their infinite problems we could come up with So we don't have toe.

  • We don't have to stick with purely CS 50 problems.

  • So when 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.

  • 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 streamers, for sure.

  • Um so why don't we go ahead and take a look at first?

  • I'm gonna save the names so far and cut this music, actually, and, uh, let's go ahead and take a look at Project Oiler.

  • So I don't remember the name of the website or the website domain actually dot net 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's 14 at least 14 pages 100 there, 655 problems.

  • So the we could start with something fairly easy, like the first problem, which is, if we list all the natural numbers below 10 that are multiples of three or five, we get 356 and nine.

  • So we need some way.

  • Thio identify whether a number is a multiple of three or five, not three and five foot three or five and then add the multiply at the multiples.

  • In that case, if you add all those multiples becomes 23 The problem here is do the same thing.

  • But for all the multiples of three or five below the number 1000 So we could we could use this use.

  • This problem is the basis for our stream.

  • We could also look at other problems.

  • But there are so many problems on Project Oiler that I'm not sure if you want to spend too much time digging into reading all these problems when we actually started writing code.

  • So if you want to try the multiples of three or five 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, uh which was what they did, which is a four loop for in 0 26 We should actually be range, I think Rain.

  • Oh, can you do four in topple?

  • Does that work?

  • I'm actually not sure, but basically, this has to be.

  • It's its own lines submitted by somebody.

  • You can't do this and then do another if statement and then d'oh another line after that, it needs to be, um it needs to be a, um It needs to be just the first part.

  • Surreal 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 zero in 26.

  • Okay.

  • Yeah, I've never seen I've never seen a couple syntax used in in a four live in python.

  • I always see range for numeric adoration.

  • But there are so many things that I don't know.

  • Um okay, so so, so sorry for folks that are watching.

  • And people on other platforms that are seeing weird stuff on your hair.

  • And YouTube or Facebook come to twitch.

  • Probably because switches the stabilised platform right now, and we'll, we'll figure out the other situation later.

  • Did I go dark?

  • Uh, cold went dark.

  • What does that mean?

  • But does it work?

  • Really?

  • Just make sure I'm reading the chat and make sure I see everything.

  • Okay, So why don't we?

  • I want him quite light.

  • Yes.

  • Good.

  • That's generally how I am.

  • You're disconnecting from real life.

  • So what I think we'll do, We'll probably will.

  • Probably just 2% since the very first.

  • The very first Ah, problem on Project Oiler.

  • And this is the first time we've done a project.

  • Everything.

  • 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, because we've already spent a few minutes with the technical difficulties that we're having today.

  • So, um yeah, let's do this.

  • Let's do the list.

  • I'll copy the project oil or sort of problems.

  • Speck 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 a CZ.

  • Another note.

  • Just let me know when you're writing your comment.

  • What line you want your your line of code to go on or specifically, That helps me quite a lot.

  • Uh oh.

  • As he's gonna leave right before, Uh, right before her turn and she wants to leave an amendment for whatever male cat puts in.

  • So you know, if you're if you if you didn't watch the prior video Male cat, um diverted us to say the least, but it was it was entertaining.

  • Dance trainer.

  • I have you so as Lee, if you're 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 Soho House or let me actually make sure I didn't miss anybody else riding the three robots.

  • I don't think I did.

  • Now I did not.

  • Okay, 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 of Colton's Harris equals short.

  • That's not valid.

  • Python syntax.

  • Ashley, You can't.

  • You can't assign an if statement yet.

  • That's added on python 3.8, though that will be added.

  • All right.

  • Thanks for thanks for popping by Ashley.

  • We will.

  • Hopefully we'll see you again in the near future.

  • Um, you will.

  • You will live on in our in our memories.

  • But we'll take the will take the first line of code from soas or so.

  • So how's or you're leading the way?

  • If we list all the natural numbers below 10 that multiples of three or five, we get 356 and nine.

  • So basically, we want a way to get all of the natural numbers below 1000 that are multiples of three or five.

  • So we're gonna need a way to get them all and then some them, and then figure out what the sum is of that information and Brax Hello.

  • So so how's or we're waiting on your line of code.

  • So how's Or if you're if you're still in the chat?

  • If not, we may have to go down to Colon, pour us.

  • And if anybody's watching it is unfamiliar with what goes on.

  • If you want to add code and get her name added to the list just in chat and twitch chat, right.

  • Three Mr.

  • Destructor in Emojis in a row.

  • Yes, M brax, you may join.

  • I need to make like a, uh, like a title card or something.

  • Um, that are like a title outline or something that will say, you know, enter three Mr Destructor.

  • And so the people watching the video, no matter what, we'll see that.

  • And they don't have to rely on a, uh, twitch pot or anything.

  • So okay, so deaf Project Nice.

  • We're off to a fantastic start.

  • So has Or and, as always, for the last, um, code base that we were in we're going thio Put everybody who's participated their name next to what they actually added to the project just so we can keep track of who's added.

  • What, Colin.

  • Porous 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, ah statement kind of specify the indentation level to say in debt into, you know, function right.

  • This line helps a little bit because python and python white space is important.

  • If you write something in here versus here, it's completely different.

  • So something to keep in mind if you were 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 three, Mr Destructor is puts you in the roster that goes to you as well.

  • Andre, if you want to participate for I in the range of 1000 okay for eye in the range of 1000 that's an excellent line.

  • I feel like that gets us somewhere.

  • So let's go ahead and put column porous there.

  • What's the best way to denote white space in a twitch?

  • Comment?

  • Um, you can just say I mean, yeah, if you put an underscore, I can assume that to be in a level of indentation, actually.

  • So it's actually pretty nice.

  • Concise, um, sort of, I guess, syntax for that.

  • So, yeah, I'll accept that.

  • So odd as zero, it is.

  • Now your turn.

  • Yo G 2022.

  • If I mon 30 I'm on 50 So again, if you're if you're riding in the chat and you're not in it, it's not your turn.

  • I won't accept your your answer, but if you want to get added to the Q, then just write three Mr Destruct rates in the chat and I will put you in the queue.

  • Yeah, I'll take I'll take, uh, backslash tea.

  • I'll take underscore.

  • I'll take the word indent.

  • Um, and people are free to write if if they want to write, suggest is they're free to write it, but they just won't be considered.

  • If it's not there, turn if they want.

  • If they want Thio, you know, people that are if it's their turn, they're free to look at other people's suggestions and use that as inspiration for the room.

  • So kinesis saying Adam is not present such a which is unfortunate.

  • Soca Nagy.

  • It is now your turn.

  • We will accept a line of code from Qin AJ and again three.

  • Mr.

  • Destructor is 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, uh, all the sum of all multiples of three and five below 1000.

  • So if you would like to participate, please do put three Mr Destruct.

  • Lloyd's in the chat and I will see it and I will write Your name note is better than Python says so.

  • Sure 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.

  • Economics is usually pretty, uh, pretty present, which is why I'm spending a few seconds waiting.

  • But I think after a few more seconds, we will, uh we will let, Yes, economics is there.

  • So, uh, if I mod three is equal to zero four, I mod five is equal to zero, and I'm gonna go ahead and in debt thes over just because it's a little bit longer.

  • Great line by, uh, Kanosh here.

  • Unknown Boyack.

  • It 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 statement says M brax.

  • We'll see Choco kid that the goal here is to get people of different experience levels involved.

  • 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 a non Boyack Wolves 46 Yo B 2022 ninja.

  • Vitas.

  • Very much appreciate it.

  • Break could break everything.

  • Um, yeah, that would break the That would break us out of the four loop, at least.

  • Um okay, so that was unknown Boy Jack.

  • And it could be bundled 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?

  • What is it?

  • Ah, where am I at?

  • Chat codes.

  • Python too.

  • Jacquot's python too.

  • And then for new Python three of Maine.

  • I think it's meant script one dot pie.

  • 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 all.

  • Adds saru.

  • And Andres says over seeing myself Oh, that was a joke, Andre.

  • I see.

  • Nice.

  • Uh, so one track system it is now your turn.

  • You need to have some difficult lines of code two.

  • Hey, it's up to It's up to the stream, right?

  • You know, if any of people want to do whatever they want to dio, they should participate and, uh, contribute in whatever way they see fit.

  • But one track system, it is now your turn to take this script Thio.

  • Its next destinations are currently the script prints.

  • Nothing at all.

  • Absolutely nothing at all.

  • Bobby Tech 18.

  • You have been added to the roster and call him for us is back in there for their round two and of our total sum equal zero after line eight.

  • Uh, what's one track system?

  • Right.

  • Okay, so on line eight, it is in haste.

  • Haste consisted of my phone.

  • I'm guessing that means you are the Jesus Christ of Python.

  • Uh, says my or 68 mood is grass is better.

  • No, estoy I think that was correct.

  • Yeah, um and this is That was one track system which said it was a total so far.

  • OK, so this is this is gonna be an interesting of our total sum is equal to zero.

  • So, you know, I might just leave.

  • I might just leave errors.

  • Lab might just do well, like exactly how people type their lines of code, and we'll just kind of let it exist.

  • And I have a limiter 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 ah, Kanon SJ and D M s M T P being added to the twitch stream after the doctoring import time.

  • Sis os just repairing 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 we 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 too.

  • Vehicle bio says keep far in there.

  • I like they did a literal transcribing.

  • Yeah, I think it's interesting.

  • I think it will give us a little bit of it'll give us a little bit of hilarity toe work with for the stream, you know, a little more interest.

  • Uh, puppet 44 11 was after the doctoring import time, sis.

  • Oh, Wes.

  • Okay, import time.

  • Cysts.

  • OS.

  • That was Puppet 44 11 And Wolves 46.

  • It is not your turn.

  • It don't want to call projects, even prints.

  • Anything says dance trainer has a good idea.

  • Someone coming out line eight.

  • Um, we are not accepting comments.

  • M.

  • Brax.

  • Oh, choker kit stream was frozen.

  • I'm sorry.

  • All right.

  • Well, it's 46 is no longer president.

  • Dance trainer.

  • It's your turn.

  • Let's see what you got.

  • Loader Kington is back from last week This pc 10 Wassup.

  • Wassup this PC 10 again if anybody's brand new doesn't know how to participate three.

  • Mr Destruct, Lloyd's of the chat.

  • We'll 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 mmm.

  • Take this moment to, uh, hydrate little bit him a little bit parched, dry mouth.

  • You can do Slash me thinking.

  • Uh nice.

  • Okay?

  • It should say is thinking I'll do what I said Add project as a function called.

  • Okay, so I will assume you mean right here.

  • So this is courtesy of dance trainer.

  • We're calling the function now that we defined up here.

  • And now it is onto the Choco Kid 21 for their contribution to the script.

  • So has or wants to get added.

  • So hot zur and dance trainer wants to get added back to the end.

  • Well D'oh!

  • Cool, cool.

  • Between line 13 and 14 x plus equals I 13 and 14 x plus equals I Okay, right here.

  • Choke.

  • Wicked 21.

  • Everything's nicely lined up here.

  • Nobody's nobody's requested an amendment yet, so we haven't had to do overline comments just yet.

  • Um but I suspect we will get there at some point, so Oh, I not one.

  • Oh, sorry.

  • My fault that even I'm making mistakes and I'm supposed to be the one transcribing word for word, but we're not printing X says under Boyack, it's a good observation.

  • Can I get added back to the Q?

  • Absolutely.

  • Ex not defined, says Onion Boy act.

  • They may be on to something M Brax.

  • It is now.

  • Your turn.

  • So just waiting on M.

  • Brax fella says hi.

  • Hello, Bella.

  • Bella, would you like to get at it?

  • And that we accidentally forgot to include you last time.

  • I would be happy to add you to the ER to the roster right now.

  • If you would like to participate, we need to add the multiples, not print them.

  • Says the choke wicked.

  • 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.

  • Our Ebola again.

  • Apologize that we missed you last time.

  • But you are in there.

  • We will get you in here.

  • We'll get you participating.

  • Replace of our total sum with X equals zero.

  • Okay, so we want to amend this line to say X is equal to zero.

  • Uh, okay, we can do that.

  • I'll consider that about amendment 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, uh, all of the errors that we had.

  • Because var is not a keyword in python.

  • That is the way in Java script to define variables.

  • But Python does not have the bark he work.

  • So so rule CS.

  • That is now your turn.

  • Oh, got to take a break.

  • Okay, that is totally fine.

  • We can we can push you off of the, uh, the roster here.

  • That is not the way in Java script, it is the old javascript.

  • Now you can say let you can say const those of the modern way to do it the old way.

  • The E s five way to program and John was script was to save our something.

  • Yes, far is outdated.

  • That is correct.

  • But it is technically JavaScript Syntex.

  • Still, it is still technically part of the language.

  • N q m Brax, please.

  • I can do.

  • And Yogi 2022 says, Can I join?

  • Yep.

  • Absolutely.

  • There is no underscore in your name.

  • What is the euro for submitting a code for review?

  • The girl for the code review is going to be CS 50 dot l.

  • I slash code review like that.

  • And true Guineas.

  • Thank you very much.

  • You almost beat me to it.

  • Not quite.

  • I beat you by just five milliseconds.

  • You should have a body for queuing.

  • I agree.

  • I was going to, uh I'll actually looked into that this morning as toe to write it on DSO I think for the next stream, I might write a twitch spot for that.

  • Yes, you're absolutely right.

  • It looks pretty easy to It's not too bad.

  • Um, probably only take me like a couple hours.

  • We need only an amendment to complete this project.

  • This PC tenses code review.

  • Clap, clap.

  • Yeah, it's fun stuff.

  • Interviews.

  • Good.

  • And the David is 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 get?

  • Not yet, Not yet.

  • Everything seems to have been pretty wholesome so far.

  • Honestly, I am really a Merlin's correct.

  • This is a one liner with a list comprehension and the some function.

  • This is a list comprehension.

  • Bella, this is the goal.

  • So listing all the natural numbers.

  • But, Lieutenant Well, actually, technically not listing them, but getting all the natural numbers below 1000 and then adding the sum of the ones that are multiples of three and five.

  • Oh, I did not get the pews reference.

  • I apologize.

  • I did not watch beauty, but I used to watch beauty pie a little bit.

  • But I do not watch him these days.

  • I probably am missing some kind of a reference, Um, shame on me.

  • MAME Review.

  • Actually, that's pretty amazing.

  • Um, it's pretty amazing interview with David Malin.

  • I'll think on that little bit.

  • I'll think of that.

  • That's interesting.

  • Um, so it's a rule that's a rule.

  • Get It's a rule.

  • Decide that they didn't want to contribute.

  • Are we goingto be Tak to rule said bye bye, right?

  • Yes, rules.

  • I've got to take a break.

  • I'll be tag 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, uh, line of code, you can type three Mr destructed robots in the chat.

  • That'll tell me that you want to be added to this Rosser of people who are going thio.

  • We're gonna contribute a line of code to the project.

  • Abby, take 18.

  • Says print ex outside the four loop and inside the project.

  • Okay, so right here.

  • So we're gonna do a print X.

  • That is obvious.

  • Tech 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 1000 that are multiples of three and five.

  • Surreal.

  • CS wants to get at it.

  • Okay.

  • And so does our be tear.

  • So I'll be attack 18 and set a rule C s now are the solutions on Project Oiler as well Doesn't actually show you what the, um that could be confirm the solution on here anywhere.

  • Or do we just kind of have thio know what it is?

  • Uh or do you have to, like, actually sign in and submit?

  • So then we need to get rid of all the outputs you know Would be kind of interesting Is if we just sores or has a link.

  • Okay.

  • Oh, yeah.

  • You were pretty much did it, right?

  • Yeah.

  • And then actually what in the stack Overflow solution the which is the ex inserted equal to the generator Expression within the some eye for eye in the range of 1000.

  • If I'm on 30 I bought five is equal to zero.

  • Yeah, that is That's the one liner that Merlin was referring Thio and, um Oh, there's an actual project solutions.

  • Uh oh.

  • Those are just the solutions.

  • The answers.

  • Okay, Cool.

  • Yeah, without without the, um, without this print, it would It would indeed be cleaner, But we're not necessarily going for perfect code.

  • Um, we're going for getting the answer, and we got the answer, right?

  • So well done till the chat.

  • That was amazing.

  • I 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 shadows Thio Puppet 44 11.

  • So, house or em Brax.

  • One track system.

  • Colin, for a scan on the Choco kid 21 on envoy back.

  • I'll be 18 and dance trainer for the contributions.

  • So very well done.

  • And, uh, Abby Tech.

  • Yeah, that was I got you in there as well.

  • Very well, done.

  • All of you.

  • Let's let's go.

  • The next problem.

  • You want to go?

  • Do we want to go to next problem?

  • Or do we want Thio do under something else?

  • We just write this a script to DuPuy.

  • How much does pet a style, matter and industry?

  • Probably a good amount.

  • I think it's going to vary on your organization.

  • CS 50 tries to adhere to it pretty pretty firmly, but I think even we deviate sometimes in subtle ways.

  • But generally we tryto adhere to them almost strictly.

  • Next problem before me out.

  • Categorize.

  • All right, Amazing.

  • So okay, task to let's do a test to starting with the roster of people that carried over from script one.

  • So we're gonna go over to Project Oiler.

  • Let's look a task, too.

  • 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 1st 10 terms will be 12358 13 etcetera.

  • So we get one plus two and then the next, and then the next number is gonna be the sum of that.

  • The next numbers after that's going to be some of these two than these two.

  • Then these two, and then these two.

  • 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 one into that sort of the initial way that we cede our data set.

  • Right?

  • So we want Thio.

  • Consider the terms of the Fibonacci sequence whose values do not exceed four million, find the sum of the even valued terms.

  • So we want to basically calculate Fibonacci up too, but less than for 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 it.

  • This is a juicy A problem.

  • This is interesting.

  • Um, it's a bit more complicated than the last time we did, but totally, definitely solvable.

  • I'm gonna go ahead and copy the problem, spect into the into the script squid and do that and do this and this.

  • So here's the comment right here.

  • The first person to kick us off.

  • Is Colin porous?

  • So, Colin.

  • Porous.

  • Let's, um, was due Fibonacci first, then the some 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, um, it's ultimately up to the chat.

  • Ultimately up to the jet.

  • So deaf.

  • Okay, so Colin poor column for us, says Death.

  • Next fib.

  • Numb Colon.

  • All right, so that's Colin Porous.

  • The next person is Kanaan, JT's Okinawa.

  • 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 for too long, Unknown unknown boy, a k or a non Boyack and a Jew.

  • So how's Doris has put brackets cases.

  • So how's or it's not your turn.

  • You're gonna have to wait your turn.

  • Ca knowledge.

  • It is your turn.

  • What would you like to dio to this script and let me go ahead and just shut out the people that are following on twitch?

  • So whips up about, uh, it's colder life and I'm a Helen thank you very much for the follows much.

  • Appreciate it.

  • Can our 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 three.

  • Mr Destructed 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, uh Marlin wants to get fancy.

  • Merlin wants Thea.

  • Merlyn wants the And we won't accept that, though, Merlin, Because again, we won't accept compound python statements.

  • But the actual gist of what you're saying is it is true.

  • However, that is a, um that will give us the number, right.

  • That will 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 it'll work in this case.

  • Uh, no.

  • You have a colon, Merlin.

  • Your death has a colon.

  • That's Ah, come compound.

  • Or like a an inline statement.

  • Essentially, essentially no loops.

  • No one line loops it Conditions or function declarations.

  • Anything that you would use a colon for is a um, yeah, The block is on one line, but we're not.

  • We can't accept that.

  • You can't accept anything that's multi line like that.

  • Um, Kanaan said sorry.

  • What's the function?

  • Doing.

  • So here.

  • I'm gonna go and just leave this up if you want to read it.

  • It's the Fibonacci sequence.

  • Right?

  • So every two neck, we start with one into 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 next to numbers are three and five at those that makes 85 and eight makes 13 18.

  • 13.

  • Makes 21.

  • So on and so forth.

  • Um, make sure one track, bro, but I bra, but I cannot spell, uh, one track system and one tax system and colon for us also.

  • Merlin, are you even participate?

  • You?

  • I don't think I've seen you try to get added to this, uh, with robots at all, ever.

  • You do seem to Ah, no python pretty well.

  • Yeah, Merlin, it sounds like you're probably 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, uh, looks like Ken AJ wrote initialized Result to zero.

  • I'm gonna need to know where can AJ where do you want me to put result equal to zero.

  • Going 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 white space sensitive.

  • So if we put if we put result here, it's different.

  • Okay.

  • Connections inside the function.

  • Okay, awesome.

  • So result is equal to zero.

  • That is courtesy of K.

  • Nagy.

  • Well, go ahead and we will.

  • Right.

  • Credit to Kanaan is right there.

  • Someone used matrix Multiply.

  • Oh, dear.

  • D m s m t p.

  • It is now your turn.

  • What do you have for us today?

  • Matrix Exponentially ation.

  • Absolutely beautiful idea.

  • No danger in that Getting unwieldy whatsoever.

  • Okay.

  • D m s m T p A is equal to one.

  • And where we're 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, uh, I know where you want your coat to go.

  • And I don't make too many assumptions.

  • Great.

  • New nine.

  • I got you down here line 12 11.

  • So between 12 and 11.

  • Okay, so we'll say, um, a is equal to one.

  • That is D m smt be awesome.

  • Thank you very much.

  • Monge one h or monkey one h what you got for me?

  • What is the next contribution to this stream?

  • And also thanks to raiding some of 1996 Ryan.

  • When?

  • How and treat Tet for the follows in line 14 while X is less than four million.

  • Okay, that is a Monge one h thank you very much for the contribution.

  • Loner.

  • Kington, It's up to you now.

  • What do we got?

  • D m s and T p I will add you d m s and T p back to the end and puppet 44 11.

  • You have been added.

  • I am new, but trying No, it's excellent.

  • That was a good line.

  • Um, that we do not have an x variable, but, uh, we will We will do our best with what we have.

  • Do we solve the first problem?

  • We did some of the first problem.

  • We solved it with flying colors.

  • Santa Claus is real.

  • Love the screen name.

  • Hello?

  • Anybody knew who is joining the twitch?

  • Chat three.

  • Mr.

  • Destruct rates 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're curious, if not, feel free to be a, uh, relaxed passer by in this journey.

  • This amazing journey loner Kington says B is equal to two.

  • Am I to assume that the line goes here loner, Kington or somewhere else again if you're contributing and it is ambiguous or if you want to just start doing this as a um, as a, uh, sort of Well, where was I 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 online.

  • 13.

  • Okay, excellent.

  • So online.

  • 13 b is equal to courtesy of a loner.

  • Cannot type loner Kington Awesome.

  • So how's or it is now?

  • Your turn.

  • What is the next contribution?

  • Yes, by submitting the code was saying, Line X, Here's the code.

  • Makes my line way easier mentioned in em.

  • If you want to contribute, you will need to get added to the cues.

  • If you want to get added, just put three Mr Destructor 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.

  • Uh, put three Mr Destruct raids in the chat, and I will call on you when it is your turn in the queue.

  • But so has or it is currently your turn.

  • I see that you had three robots in the chat earlier, but not any code yet.

  • So before I add you to the cue, we're gonna need some code from you Loner Kington, you have been added back to the list.

  • Eso as or if it takes too much more time, we might skip you.

  • Unfortunately, R J s and K 501 So how are you going to write code or do you want Do you want to skip it?

  • For now?

  • I can't think of a wild thing.

  • That's okay.

  • If you want, we'll pass.

  • We'll 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?

  • Eso has or I'm not sure what you mean.

  • You'll have to specify your line of code.

  • You can.

  • You can amend.

  • You could make an amendment to the while.

  • You can specify a new line, but I'm not entirely sure I am probably going to 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, you want ask.

  • I can, and I will answer that.

  • But if you make it outside of the context of the problem, like if you if you Yeah, okay.

  • So sores or 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, um four eye in the range of four million.

  • Cool.

  • Thank you.

  • So his or so dance trainer is no.

  • Your turn.

  • Hello, Martin.

  • Good

all right, Tell the world this is CS 50 Live.

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

B1 中級

CHAT CODES PYTHON AGAIN!- CS50ライブ、EP.56 (CHAT CODES PYTHON AGAIN! - CS50 Live, EP. 56)

  • 0 0
    林宜悉 に公開 2021 年 01 月 14 日
動画の中の単語