And check the answers, and say yeah that's what we expected. But it also involves reasoning. About why that's an appropriate set of inputs to test it on it.
然后说对,这就是我想要的结果,但是它跟推理也有关系,表现在关于为什么这是一个,测试我们程序的适合的输入集。
OK, so what have I done? I just added a little bit more now. I'm now running through a pair of loops. Again notice the encapsulation, that nice abstraction going on, which is what I want. Once I get to this stage though by the way, there might be more than one solution.
我现在运行了一对循环,再一次注意这个封装,抽象得很好,这就是我想要的结果,我按这种方式走到这一步的时候,可能会有多组答案。
But I would choose to sit down for these particular projects right around midnight so that when I woke up my program was giving me the results I wanted.
我可能会,为了这些特殊的项目一直等到半夜,这样我醒来时,程序就能给我想要的结果。
So, there would have been a certain amount of just furious killing going on, but I don't think that would have been the way you planned the game.
有些人会因此死于,疯狂的杀戮,但我认为,这并不是战争想要达成的结果
Suppose instead, I want a machine that can take a recipe, the description of a sequence of steps, take that as its input, and then that machine will now act like what is described in that recipe.
假设换成这个,我想要一台可以安装描述,一系列步骤的结果的方法的机器,把那个当做输入设备,然后那台机器可以像方法中,描述的那样运行了。
And of course I get out the value I'd like there.
当然我会从这里得到我想要的结果值。
So in some sets, as long as x has the value I want, it ought to do the right thing.
所以在某些结构中只要x的,只是我想要的我就能得到正确的结果。
And in Python the expression is, operand, operator, operand, when we're doing simple expressions like this, and if I give it to the interpreter, it gives me back exactly what you'd expect, which is that value. OK?
在Python中表达式就是,运算对象,操作符,运算对象,当我们处理这样的简单表达式的时候,我把表达式传给处理器,处理器给我返回了我想要的结果,对不对?
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会将,输入的值传递到下面的,一些运算中去,如果这个值的类型不是我想要的,我可能会在得到,一个毫无意义的结果之前,经历一个很长时间的,计算过程。
Is the first part. That says, I took the branch through here that eventually got to the end and said, there wasn't a solution, in which case I'mgoing to print out, there ain't no solution, otherwise I'll print out the pieces. All right, let's check it out. Ah, what did I say?
我是否返回了特殊的none值?是第一部分,这里的意思是我从这个分支,走到这儿最终走到最后,并告诉我这条路没有解决方案,也就是我想要打印的结果,没有符合的结果,否则我会把它们输出来?
应用推荐