Just sixteen percent thought it was OK to take that phone call.
VOA: special.2009.03.12
OK, now what I want to do is just describe a little bit of how do you measure all this stuff, right?
好,现在我要做的就是,介绍一下怎样来测量这些东西?
You just want to get the overall idea of what is being said so that you're able to respond. Ok?
你只是想了解人们所说的话的大意,那样你就可以做出回答了,对吧?
OK. Now. This is just sort of bringing us back up to speed and adding a few more details in.
好,现在,我们刚刚回头,过去看了一些,细节问题。
OK. We're going to just try this one more time just so you can see it.
好的,我们将要再尝试一次,这样你们就可以看到它。
OK, so here is just an engine like what we've already seen, and I'm going to specify that this is a Carnot engine which is to say all the results that we just derived hold for this case.
这一个热机,跟我们以前见过的差不多,我们把它确定为,卡诺热机,所以我们之前得到的结果都对它适用。
The disease model,the optimum level is the zero: let's just be Ok; let's just not hurt.
对疾病模型而言,最优水平是零:,我们都平平安安,别受伤就好了。
Just say, OK we have eight real intelligent people here.
换言之,怎么样安排这八个聪明人。
I just wish we could do it together, but that's ok.
我就是希望我们俩能一起玩,不过也没什么问题啦。
In the example I just wrote here, this is pretty trivial, right. OK, I'm trying to input floats.
在我写的这个例子中,这是很微不足道的。
OK, I want to spend the last few minutes just showing you a couple of other things that we can do in here.
好,我想把最后一点时间,用来给大家看看我们能做的,一些其他的东西。
Well let's see. My fall back is, I could just do linear search, walk down the list one at a time, just comparing those things. OK. So that's sort of my base. But what if I wanted, you know, how do I want to get to that sorted list? All right?
我只能做线性搜索了,一次遍历一遍列表,一个一个比较,但如果我想要,那怎样得到有序的列表呢?,现在的一个问题是,我们排序之前?
Let's just go through these laws, OK, very quickly.
让我们快速地,过一遍这些定律。
Right now, this is just a text file. OK.
好,这就是一个文本文件,好。
Now we can think about the fourth period, and the fourth period is where we start to run into some exceptions, so this is where things get a teeny bit more complicated, but you just need to remember the exceptions and then you should be OK, no matter what you're asked to write.
现在我们可以考虑第四周期,而且在第四周期,我们会遇上一些特例,所以事情有,一点复杂,但是你只需要记住,这些特例然后就没有问题了,无论你被要求写什么。
It's all OK. Just breath.
都没关系,呼吸。
Sorry? OK. You're doing the whole thing for me What's the complexity just of this inner loop m How many times do I go through that loop?
就这一块代码的,我执行了多少次这个循环?,次对不对?,here?,Just,this,piece。,我一会儿就会去得到你的答案的?
OK, so far though, I've just shown you what happens inside a peace a code. It raises an exception. It goes to that accept clause. We don't have to use it just inside of one place.
好了,我已经给你们看了,代码内部发生了什么,它报了一个异常,然后就到了处理的片段,我们不该就在一个地方用它。
OK, let's just turn the crank on the maths.
好,让我们开始数学推导。
Ok, watch me: Just like this, Ok?
看着我,就像这样?
OK, I can certainly print out strings, but I can actually add strings together, and just as you saw, I can multiply strings, you can kind of guess what this is going to do.
当然我可以显示字符串,但是其实我还可以令字符串相加,如你所见到的,我可以令字符串相乘,你们可以想想答案是什么。
OK. Don't sweat the details, I'm just expanding it out.
我只是把它展开了而已,我想大家注意到的是。
OK. The other thing I want to say here, is that this style of program we just wrote is actually a very common one. And we're going to give it a nice little name, often referred to as exhaustive enumeration.
好,另外一件我想说的事情是,刚才我们写的代码的风格,是非常普通的,我们会给这个风格一个名字,通常是被称为详尽的列举。
And keep going, until the square of one of those integers is greater than or equal to - sorry, just greater than x. OK, why am I doing that? When I get greater than x, I've gone past the place where I want to be.
如果还是比x小的话,跳到3,这么继续下去,直到一个整数的平方大于或者等于,对不起,是大于x,好,为什么我要这么做呢?,让我得到的整数的平方和。
Ok, just fine, 2 it's no big deal.
我们定义这个点的半径为,然后角度pi是。
OK, you've actually seen exceptions a lot, you just didn't know that's what they were, because exceptions show up everywhere in Python. Let me give you a couple of examples.
好的,你们实际以及看过很多异常了,你就是不知道这些是什么,因为异常在Python中随处可见,我给你举些例子。
And if I were to use that again, I'd just put it on your handout, I could go back and rewrite that thing that I had previously for finding the square roots of the perfect squares, just using the FOR loop. OK. What I want to do, though, is go on to-- or, sorry, go back to - my divisor example.
它可以是任意的集合,如果我又要去用这个方法的话,我会把它放在你们的课堂手册上的,我可以回过头去用FOR循环,重新写我们那个求平方数的程序,我想要做的是,是继续-哦抱歉,回到-我的除数那个例子。
OK. So it's just adding 1 to x.
好了这就是给x加1。
OK, so how can I code this up? Well, you might think, let's just jump in and write some code, I don't want to quite do that though, because I want to show you another tool that's valuable for thinking about how to structure the code, and that is a something called a flow chart. Now.
好,那么我怎么把这个以代码实现呢,你可能会想,让我们进去直接写代码把,但是我不想这么做,因为我想教给大家另外一项很有价值的,用来组织代码的工具,叫做流程图,现在,像Guttag教授,和我这么大岁数的人。
应用推荐