• All right, you can see that this little piece of code, it's got a loop in there, and what's it doing?

    好,你们看到的这一小块代码,是做了一个循环吧?,他在做什么?

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • And then I run a loop in which I read something in, I check to see if it's the right type, if it is, I change that variable to say it's now the correct type, which means the next time through the loop, I'm going to say I'm all set and I'm going to bounce out.

    因为我还没输入,然后我运行一个循环,循环内部我输入一些东西,然后看看是不是正确的类型,如果是的话我改变input,Ok为真,来证明输入数是正确的类型,这就意味着下一次运行这个循环的时候,就可以跳出循环继续执行了。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Condition," this thing in the middle between the semicolons, is going to be checked every iteration of the loop.

    条件,“这个在两个分号的中间,它将迭代地检查这个循环的条件。

    哈佛公开课 - 计算机科学课程节选

  • And there is a self-enforcing loop between the two, where helping others helps ourselves; and helping ourselves, in turn, helps others.

    两者间有自我实施的循环,帮助他人就是帮助自己;,帮助自己继而帮助他人。

    哈佛公开课 - 幸福课课程节选

  • So we'll loop back to this in just a moment, but start by going back earlier in history.

    我们稍后会回来继续讨论,先让我们回到早些时候

    耶鲁公开课 - 关于食物的心理学、生物学和政治学课程节选

  • I've written a little for loop, which is going to iterate over all of the elements in the list.

    让我们先看看这儿的代码,我已经写了一个循环语句,用来迭代处理数组中所有的元素。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • We're gonna have a so called a loop, an infinite loop and you actually experience this in the real world.

    我们将会做一个循环,一个无限循环,你会在这个,真实世界里体验它。

    哈佛公开课 - 计算机科学课程节选

  • And what's this little loop say to do? This little loop says I'm going to write a function or procedures that takes in two messages.

    这个小循环是做什么的,这个小的循环是,我要写一个函数或者过程来接受两条消息。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • If we weren't so pressed for time, I kinda wanna see how long we could get away with this before it gets awkward, but that, in fact, is an infinite loop t hat's hopefully deliberate.

    如果有时间,我想看看,我们需要花多长时间解决这一问题,事实上,它是我故意,使用的无穷循环。

    哈佛公开课 - 计算机科学课程节选

  • printf So here I'm culling printf in a loop again and again, but I'm literally overwriting the previous thing that I wrote.

    所以这里我一次次地在循环中使用,但是我逐行地覆盖了我之前所写的东西。

    哈佛公开课 - 计算机科学课程节选

  • On last week too we saw-- and in your projects you might have seen a so-called repeat loop.

    在上个星期-,在你们的工程里面,可能会看到所谓的,“重复循环“

    哈佛公开课 - 计算机科学课程节选

  • And we won't wait here one hundred seconds for it to finish, but we're using the loop, we're updating a variable, and we're formatting it in a nice way.

    我们将不会再这里等待100秒来等它完成,但是我们使用循环,我们更新一个变量,我们把它排成一个漂亮的格式。

    哈佛公开课 - 计算机科学课程节选

  • So in a sense, that's a good infinite loop that is as long as you're using the program, it's constantly checking your grammar and spelling, and underlining things, so infinite loops aren't necessarily bad if the objective is actually being met.

    因此从这个意义上说,这是个好的无穷循环,只要你开始使用这个软件,它不停的检查你的语法,拼写或者下划线等,通过这种方式达到目标的时候,这样的无穷循环并不总是坏的。

    哈佛公开课 - 计算机科学课程节选

  • I'm going to run through a loop, and I'm going to request some input, which I'm going to read in with raw input.

    我要运行一个循环,我需要一些输入,需要读入一些原始的输入。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • And so the guys in Office Space took that money and they-- -- their for loop-- way too fast is-- was the takeaway in that movie, when they freaked out because they had million dollars or something like that overnight.

    所以在办公地点里的家伙才能够搞到钱-,然后利滚利--很快的方法-,这就是整个影片的亮点,当他们出于极度兴奋之中,因为他们已经一夜之间,变成百万富翁了。

    哈佛公开课 - 计算机科学课程节选

  • Then the next thing in the loop, we're going to enter a nested loop and say for every college in the list e, we're going to print the name of the college.

    循环中的第二件事,是进入一个嵌套循环,这个嵌套循环将数组中的,大学名字显示出来。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Well, you'll know when it crashes, that doesn't help you very much, but you can't always tell whether something's stuck in an infinite loop or whether it's simply taking a long time to compute.

    好,你将学到它在什么时候会崩溃,这对你帮助并不大,但是你不能辨别出到底是在一个循环中,有什么东西卡住了呢,还是程序需要很长的时间来计算一个结果呢。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • At the end of the first round, I've got the smallest element at the front. At the end of the second round, I've got the smallest two elements at the front, in fact I got all of them sorted out. And it actually runs through the loop multiple times, making sure that it's in the right form.

    看看发生了什么,在第一轮结束后,我把最小的元素移到了前面,第二轮结束后,我把最小的,两个元素移到了前面,实际上,所有的元素都排好序了,实际上,这个算法运行了几次循环,确认下这是正确的形式。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • What's the first thing I do in a loop?

    我在循环中做的第一件事情是什么呢?

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • And remind you that inside of here, I'd better be changing the variable. All right, if that variable that's counting is not changing I'm going to be stuck in an infinite loop, so I ought to that, right, expect somewhere in there, a change of that variable. All right?

    我最好改变了计数器的变量值,好,如果计数的变量没有变化的话,我就会被卡在一个无限循环里面,因此我应该【不可闻的声音】,对,在这里的某个地方,改变下计数器的变量,对不对?我要做的最后一件事情就是?

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • One of the things we said last time was, with that set of things, the ability to give values-- sorry, to give names to values-- the ability to make decisions, the ability to loop as a function of that, the ability get things in and out, we said that that actually gave us a language we said was Turing-complete.

    上次我们和以上内容一起说过,我们可以赋值--抱歉,为数值命名--可以做出判断决定-,并且据此进行循环,可以输入输出数据,我们说拥有这些功能的语言,是图灵完备的。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Yes. The point is, it's not going to work, and she caught both of them, impressive, it's not going to work because iters left is already negative, it's just going to skip the whole loop, and I'm in trouble, so thank you for catching that.

    是的,重点是,程序不会运行的,她发现了两个错误,很令人敬佩,程序不会运行,因为iters,left已经是负数了,它会跳过整个循环,然后就有麻烦了,谢谢你提出这个问题。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • is run a FOR loop here. I'm going to let the number of chickens be in this range.

    我知道怎么做对吧?写一个小循环,我所需要做的就是运行一个for循环。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Because the for loop hands me placeholders in between those semicolons for variables and such, now I don't have those with while loops.

    因为for循环给我提供了为变量准备的占位符,它们在分号之间,现在在while循环中,我没有这些。

    哈佛公开课 - 计算机科学课程节选

  • I'm going to give a name to that. And what you see there is I'm going to call divisors initially an empty tuple, something has nothing in it. Right here. And then I'm going to run through the same loop as before, going through this set of things, doing the check.

    你们可以看到这里,我初始化一个空的元组,名为divisiors,这里,然后我会去运行,跟以前一样的循环,遍历这个集合内的东西,然后做检查,现在我要做的是,每次我找到了一个除数我要把它收集起来。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • And then we looked at this little loop before, for i in range number of stocks, I'm going to create two different lists of stocks, one where the moves, or distributions, are chosen from a uniform, and the other where they're Gaussian.

    这里的这个小循环,因为i代表股票,我会建立两个不同的股票链表,一个是代表股票价格的移动,或者说是分布,它们是从均匀分布中得出的,而另一个链表是从高斯分布中得出的。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • So in other words, if you terminate these lines early, if you terminate the four loop early, if you terminate an if condition early with that semicolon, the code may very well work; and this is a common source -- of frustration and conundrum because you don't -- because your code looks right and yet it's misbehaving, but that semicolon means stop looking for subsequent lines of related code.

    换句话说,如果你用分号过早的终止了这些代码行,如果你过早地终止了那个for循环,如果如此,一个if条件,代码可能可以运行,这就是,挫折和问题产生的源头,因为你没有-,因为你的代码看起来是正确的,但是运行是错误的,那个分号的意思是,停止寻找后面相关的代码。

    哈佛公开课 - 计算机科学课程节选

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定