• By putting it in a function bug if I find a bug and I change my program I can just run the function again.

    把我输入放到一个函数里,如果以后我在程序中发现了一个,并对程序进行更改的话,我可以直接。

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

  • OK. I get the two values in, what do I need to do, well, you sort of know that, right?

    好,有了这两个输入了,我接下来将要做的,你知道对不对?

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

  • s1 We're assigning to s1 the string that the user typed in.

    我们把用户输入的字符串赋给。

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

  • OK, says it says enter a float. I give it something that can be converted into a float, it says fine. I'm going to go back and run it again though. If I run it again, it says enter a float.

    好了,看到他说输入一个浮点数,我输入它可以转换为浮点数的,那没问题,我回过来再运行一遍,如果我再运行一遍。

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

  • You notice what it did, it printed out that little, right up here I'd said enter a number and that's what it's printed out, so I can enter a number and it prints it out.

    注意这个程序做了些什么,显示出了指定,然后显示需要输入个数字,然后程序会显示这个数字,我输入一个数字然后程序显示了它。

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

  • Need to get the base in. Second thing I want to do, I need to get the height, so I'm going to input a value for the height, also as a float, a floating point.

    也就是输入底的,第二件我想要做的,事情就是得到三角形的高,因此我会输入一个作为三角形的高,同样也是一个浮点数。

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

  • It's going to do a lot of type checking for you before it actually passes things back.

    它会在将输入进行计算之前,做很多类型检查。

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

  • Now what I'm going to try and do is read in a set of values, but I'm going to give a type of value as well as the messages.

    现在我要做的是输入一些,并关注异常,我会输入消息以及一种其他的

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

  • Why is that better than typing them?

    这比起直接输入这些来由什么好处呢?

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

  • But here's a new and improved, I think, version of increment; ++ returns nothing, takes nothing, but it does perform plus plus, but I did something stupid.

    但这里是一个新的,改进了的increment版本;,没返回,没输入,但它执行的是,但是我做了件愚蠢的事情。

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

  • But if I say turn this into a float, ah it throws a value error exception.

    它就会抛出一个错误异常了,它会告诉我输入了一种错误的

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

  • So it does that for us so that you can get away with just knowing the address of the first byte and it will make sure that you know when to stop by including the special value so, in fact, get the string if you type in a three-letter word, we allocate four bytes no matter what because we need an additional byte 0 for this special sentinel value back slash zero at the very end.

    它为我们做了这些事情,这样我们就可以,通过第一个字节的地址,它还可以通过包含一个特殊的,来保证在哪里停止,如果你输入了一个三个字母的单词,就可以获得那个字符串,不管怎样,我们分配四个字节,因为我们在末端需要一个额外的字节,来保存这个特殊的标志--反斜杠。

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

  • Well this is leading up to why I want to gather things together in classes to start with.

    收集起来的话题了,在Python中这么输入,然后得到是完全合法的。

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

  • It's going to print out even or odd, depending on whether the value I put in, which is x in this case, is even or odd.

    它会打印奇数或者偶数,这取决于我输入,也就是这个例子中的x,是奇数还是偶数。

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

  • It ran through that sequence of instructions, in particular it bound x to the value three, x and then it took x times x, got the value of x multipied by x, which of course is nine, bound that to the value of x, and then it printed out the value, and now it's sitting here waiting for an input.

    程序按照指令的顺序去执行的,首先是把x和3这个进行了绑定,然后把x乘以,得到了x乘以x的,当然也就是9了,然后把x和这个进行了绑定,然后显示出这个,然后就等待输入

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

  • I'm passing as input the value in X, which is two.

    我把那个输入传给X,那个是。

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

  • If I get 0 I return 1.

    如果我输入是0我会返回。

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

  • Because in doing that, Python would then have a value that it could pass on into some other part of a computation, and if it wasn't what I wanted, I might be a long ways downstream in the computation before I actually hit some result that makes no sense.

    因为如果这样做的话,Python会将,输入传递到下面的,一些运算中去,如果这个的类型不是我想要的,我可能会在得到,一个毫无意义的结果之前,经历一个很长时间的,计算过程。

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

  • I would like you to look at this piece of code right here called isPalindrome.

    我将会输入一个字符串,命名为s,并局部赋

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

  • What value of inputs, what values of x will this run correctly for?

    这个程序正常运行的话对于输入,也就是x的,有什么要求呢?

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

  • And conceptually, the idea of cubing a value feels like you could package that up into a little box, a little tool that takes input, a value, and returns output the answer A* so you don't have to constantly do A star, A*A So this program ,at the end of today, is pretty much the same thing.

    概念上,算一个的立方就像是,你可以把一个打包放在一个小盒子里,一个用来接收输入的工具,一个,然后返回一个答案,所以你并不需要一直使用,等等。,A,star,,A,,and,so,forth。,这个程序,最后,是一个差不多的东西。

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

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

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

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