• And I responded to at least one email about this issue, someone quite correctly said tuple are immutable, how can I change one?

    我在不止一封邮件里回复了这个问题,一些人很明智,知道不可变,但是疑问怎么能去改变他们,我的答案是?

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

  • My answer is, you can't change one but you can create a new one that is almost like the old one but different in a little bit.

    既然你不能改变,你可以新建一个跟原来的,大体上一致但有细微差别的

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

  • And the nice thing is that there's a shared behavior there. Just as I can have tuples as an ordered collection of things, strings behave as an ordered collection of things.

    共享的行为,就像是有序的素序列,字符串也是有序的素序列,因此我可以对字符串做同样的操作,我可以把它们连结起来。

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

  • In fact it gives me back, now I hate this, it's actually a list it's not a tuple. But for now think of it as giving you back an explicit version of that representation of all those elements.

    它实际上是一个数而不是一个,但是现在你们可以把它认为,是明确的这些,素的一个表示,你会在接下来的一些课程中看到。

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

  • We've looked so far really at two non-scalar types. And those were tuples written with parentheses, and strings.

    关于这两种基本类型我们已经,学的相当多了,包括哪些和字符串类型。

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

  • I shouldn't say list, those two tuples, and walk through them to find the pieces that match up.

    除数数进行对比,我不该说数的,是,遍历这两个找到相同的素。

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

  • I did not want to make a list, I wanted to create a tuple thank you for catching it. I want parens not square brackets there.

    为什么这里有错误了,我并不想要创建,一个列表,我想创建一个,谢谢你,发现了这个错误。

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

  • STUDENT: So are you entering a tuple in for start and end?

    学生:那么你把开始点和结束点,访在一个里面输入么?

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

  • Now what I'd like to do, every time I find a divisor I'd like to gather it together. So I'm going to create a tuple of one element, the value of i.

    那么我就会去创建只包含一个素的,也就是这个除数了,然后,啊,很好,这里是加法重载的一个很糟糕的应用。

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

  • All right. What does this have to do with my divisor example? This says I can make tuples, but imagine now going back to my divisor example and I want to gather up the elements as I go along. I ought to be able to do that by in fact just adding the pieces in.

    这意味着我可以创建了,但是想像下回到我们的除数的例子,在处理过程中我们想把目标数的除数,收集起来,我应该能够通过把这些数,一个一个加进来来实现这个目的,我正是要去这么做,也就是。

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

  • All right, they're not tuples, they're simply an instance with some structuring.

    传入这些类的实例,好,他们并不是

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

  • OK. And how do I create them? Well, the representation is, following a square bracket, followed by a sequence of elements, separated by commas, followed by a closed square bracket.

    就是一个有序的序列,好,那么我们怎么创建呢?,好,表达式是,一个方括号,后面是一系列的素,以逗号分开,以一个闭方括号结束,这就是我刚才所说的。

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

  • So, for example, if I say TEST and I don't give it a start but I give it an end, then it gives me all the elements up to that point.

    例如,我创建了TEST这个我没有给他,起始点却给了它一个结束点,然后程序会基于这一点放置所有的素。

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

  • 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,这里,然后我会去运行,跟以前一样的循环,遍历这个集合内的东西,然后做检查,现在我要做的是,每次我找到了一个除数我要把它收集起来。

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

  • So I guess I should go back, and let me do this correctly this way. Again, I can look at test, test and I guess test now if I want to get the element out-- angle bracket or square bracket?

    但是这不是我想要的对不对?,我认为我该回到这里,让我改正这个错误,好,那么我还是对,那么现在我想从test中取出素来?

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

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

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

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