• What we will distribute for most lectures is a handout that's mostly code examples that we're going to do.

    我们大多课堂上会散发一些,印着我们要做的,代码范例的资料。

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

  • And the second thing that we talked about is this idea that we want you to in fact learn how to relate a choice you make about a piece of code to what the efficiency is going to be.

    关于这个方法第二件事,就是我们实际上希望,你代码的时候,能做出优化效率的选择,因为此。

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

  • > That lets the compiler know that you want to use some actual compiled code from that library.

    >,那是告诉编译器我们想要程序库中,使用一些当前的编译后的代码

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

  • So if in fact I wanted to make sure this was a number, I should have done something like either try and convert it to a number, which of course failed here, or put in a check to say where it is.

    因此实际上如果我想确保,这是一个数字的话,我们的课程上的代码,这里失败了,你或许应该这里,放一个检查的东西。

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

  • We hand you a bunch of programming code that we wrote because this is very much the norm in the real world.

    我们给你们一些我们自己写的代码,因为现实世界中这都是非常正常的。

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

  • And henceforth I'm gonna start calling these tools, these monickers that I can use as building blocks in my own program, it's gonna be called a function as we'll see.

    从此以后,我将我的程序里把这些工具,称为我们可以用来写代码的组件,我自己的程序中,我们将了解到它被叫做为一个函数。

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

  • Now you have a set of parentheses as we'll see int i=0 in actual code and then I have int I equal 0.

    你将会实际的代码中看到一对圆括号,比如,我们让。

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

  • Good programming style. All right? Things that we ought to do, as you put these pieces together in order to give you really good code.

    优秀的编程风格,对不对?,为了得到真正优秀的代码,我们代码放到一起的时候。

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

  • Give you some examples. What have we talked about? We've talked about things like using comments to highlight what you're doing in the code, to make it easier to debug.

    给大家举些例子,我们一直强调什么来着?,我们讲过要用注释来说明,你代码中进行的操作,以便于调试。

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

  • Let's run merge sort on it, and then we'll look at the code.

    我们这个列表上运行归并排序,然后我们看一下代码

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

  • And for a couple of reasons, one this is the first P set where we're actually gonna give you code to work from.

    由于一些原因,这里是第一个习题集,我们提供了一些代码供大家参考。

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

  • So we've embedded some error checking, if you will, into our implementations.

    所以我们植入了一些错误校验,如果你愿意,在我们的执行代码里。

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

  • Everything inside of the curly braces is the code I am writing.

    所有大括号里面的代码都由我们自己编写。

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

  • And what we'll be doing is, early next week we'll be distributing code, which we'll ask you to study, about two or three pages of code, and then on the final we'll be asking you questions about the code.

    我们要做的就是,下周前半部分我们会发一些代码,给你们去研究,大概有两三页纸,然后期末的时候,我们会问你一些有关代码的问题。

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

  • And let's take a look at it. OK?

    在我们代码之前?

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

  • Remember last time, I said that there's different kinds of complexity in our code, and I suggested for simple branching programs, the amount of time it takes to run that program is, in essence, bounded by the number of instructions, because you only execute each instruction at most once.

    但是这里有个很重要的点,记得上节课,我提过在我们代码中,有不同种类的复杂度,而且我还说了对于简单的分支程序,运行这种程序需要的总体时间,大体上,是和指令的数目相关的,因为每个指令只会被执行最多一次。

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

  • If I go back to that code from a moment ago, and I just rerun math3, notice how many places printed after the decimal point -- two?

    如果刚才我回到那段代码中去,我们回到math3,请注意小数点后面,会打印几位数呢--两位?

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

  • What we're really getting at is the idea of saying I want to have a way of grouping together information into units that make sense. So I can go back to one of those topics we had at the beginning, which is the idea of abstraction, that I can create one of those units as a simple entity, bury away the details and write really modular code.

    组合成为有意义的单元,那么这就让我们回到,一开始讲的话题之一了,这就是抽象的概念,也就是我可以以一个简单的,实体的形式创建这样的一个单元,把具体实现隐藏然后写一些,真正模块化的代码,我们以后的课程中。

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

  • And that shows you one other nice little thing we want to do, which is if I look in this code notice I set up a variable up here called false Solution Found, initially bound to false.

    这显示了我们想要做的另一件事,那就是我这段代码中设置了一个,名为Solution,Found的变量,初始值设为。

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

  • So now, in this case, this code is going to, when we get here, check, and if you haven't seen that strange thing there, that exclamation point in bang computer-ese called a bang, it says x if ANS star ANS is not equal to x, all right?

    那么现这个例子中,当我们执行到这里,代码会去检查,如果你没有看到过这个奇怪的东西,这个感叹号计算机学中被叫做,代码的意思是如果ANS的平方不等于?

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

  • Most of the time, we're going to be doing expressions inside of some piece of code, inside of a script, which is the Python word for program.

    大多数情况下,我们一些代码内部,写一些表达式,一个脚本里面,也就是Python里面对程序的另一种叫法。

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

  • And then on the right hand side I++, we saw that in pseudocode with our socks example last week that just says increment I.

    然后是最右边的i++,我们上周socks例子的伪代码中,曾经见到过,不是么?只是代表i加1而已。

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

  • And the reason that we now on the second line have the equal sign is because this function GetString has what's called a return value.

    我们之所以,第二行代码GetString前面加上等号,是因为这个函数会带回一个,返回值。

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

  • Now, the one that we're most interested in ANS is the one where, in fact, it gets out ANS, so you see down here in the code, there's a spot where it's going to return the value of ANS, which is what we want, right? That's the thing that holds the value that we intended to have.

    在我们最感兴趣的是这个,事实上它返回的是,所以你看这段代码,这里返回ANS值,也就是我们想要的,对吧?,它就承载了我们想得到的值。

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

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

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

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