最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

【公開(kāi)課】麻省理工學(xué)院:Python教程(全65講)

2023-08-29 22:46 作者:壹虛居士  | 我要投稿

計(jì)算機(jī)科學(xué)、編程思維與原語(yǔ)


Imperative knowledge is a methods or recipes for finding something.

Not perfect, but close enough.

Normally, the flow runs this way, but based on that test, we have a way of going back up and continuing the path.


  • sequence of instructions

primitive instructions

→(construction)sequence of instructions

→(interpreter)executes each instructions in order


  • A basic machine architecture

Turing showed that using six primitives, can compute anything, and modern programming languages have a more convenient set of primitives.

our goal: capture how to knowledge by breaking problems down into mechanical steps and then to figure out how to turn that into something the machine understands,


  • primitive operation


  • primitive constructs

?
05 創(chuàng)建“方法” P5 - 01:42
?

what we need to pay attention:

  1. syntax
  2. semantics







編程知識(shí)


?
07 編程的語(yǔ)言 P7 - 00:09
?
第一次進(jìn)度





  • Python programs


  • Scalar object


運(yùn)算優(yōu)先級(jí):乘方>乘法>整除>加法>減法

  • comparison


  • non-scalar objects




?
11 程序(或腳本) P11 - 01:31
?

可不可以這樣理解:函數(shù)就是一個(gè)轉(zhuǎn)換步驟,把輸入表達(dá)的操作從編寫(xiě)代碼的環(huán)節(jié)移到了程序啓動(dòng)以後,相當(dāng)於讓用戶(hù)來(lái)編寫(xiě)表達(dá)代碼?

the name name to a particular string, and I can use it elsewhere.

In fact, a really good piece of code should be well-commented and therefore should be very readable by a user to understand where things are.

  • 條件語(yǔ)句conditional

we use double equal sign for comparison, and use a single equal sign to reserved for assigning a name to a value.



循環(huán)——書(shū)寫(xiě)簡(jiǎn)單程序的能力,迭代,重複計(jì)算與多次執(zhí)行




Use that iterative loop, and now that what we are doing is just walking through qenerating guesses for the cubed root of something until we find an answer that is close enough or beyond where I want it to be.

計(jì)算機(jī)的工作原理就是猜測(cè),所以我們既需要用一個(gè)函數(shù)存放每次猜測(cè)的數(shù)值,也需要賦予一個(gè)初始值,表示我們從這個(gè)數(shù)字開(kāi)始進(jìn)行猜測(cè).



  • for循環(huán)


  • float

整數(shù)的十進(jìn)制數(shù)轉(zhuǎn)換爲(wèi)二級(jí)制數(shù),就是將每一位除以2,取餘數(shù)(1 or 0)作爲(wèi),取整再與2相除.

what about fraction?

python的設(shè)計(jì)者規(guī)定,0.1在計(jì)算機(jī)內(nèi)部實(shí)際上并不代表0.1

we just cycling through this, cutting in half each time, the size of problem until I get to something that's close enough.

we saw when we wanted to move to floating point, we needed to be little more clever, and that led us to the idea of bisection as a smart way of reducing the computation at each stage, especially when we have functions or problems when there's a monotonic relationship between the value we're looking for and the guesses we're making.


  • Newton - Raphson

What Newton showed was that for things like polynomials.

令f(x)=0,取泰勒多項(xiàng)式的前兩項(xiàng)作爲(wèi)近似,也就是一階泰勒多項(xiàng)式,從而得到迭代公式:



循環(huán)計(jì)算機(jī)其抽象化

Looping computations and abstract them.

We'll capture the idea of a computational method inside a function, allowing us to separate the details of how we do the computation from the use of the computation.

儘管已經(jīng)學(xué)習(xí)了如何使用計(jì)算機(jī)進(jìn)行計(jì)算 ,我們的代碼仍然缺乏被稱(chēng)之爲(wèi)“抽象化”的東西.


idea of functions


但是我們不能重複使用x和y,因爲(wèi)這樣有可能改變x和y的數(shù)值.

we'll see is that within that body, we're going to use the names of the formal parameters to identify the places, where we want to use the values associated with those parameters.

Inside of the parens here I've got 2 formal parameters, x and y.

and then the body is simply a description of the computations I want to do.

body can be any legal Python expressions.



ideal of environments

the form is so called environment, which gives us variable names and values as associations.

We are actually just keeping track in this environment of bindings of variables, looking them up when we need them, and re-changing them with assignment statements when we have to.

需要命名變量才能夠?qū)⑵湔{(diào)用,這多少讓人想起給物品命就有用其使用權(quán)的異世界世界觀設(shè)定.


Python會(huì)自動(dòng)使用局部變量,因此給參數(shù)使用何種命名,它們是否在其他地方綁定也並不重要.


use that loop, we'll print something up to tell us where we are, and we'll chage the value in result.


what happens inside of the binding:

we create the definition of f.

and in my global environment for Python, that says I've got a binding of f to the procedure.

the formal parameter is just there as text, it hasn't actually been evaluated yet.

The invocation of f says create a frame in which the formal parameter x is going to have a binding.

?
26 理解變量綁定的例子 P26 - 06:07
?

求求你説點(diǎn)我能聼懂的吧,我什麼都願(yuàn)意做......



【公開(kāi)課】麻省理工學(xué)院:Python教程(全65講)的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
紫阳县| 望都县| 亳州市| 同仁县| 丰都县| 临朐县| 板桥市| 名山县| 桂平市| 南靖县| 武宁县| 尼勒克县| 太和县| 宣化县| 景德镇市| 潢川县| 友谊县| 黑龙江省| 汉中市| 南召县| 清苑县| 昌平区| 绥棱县| 麻城市| 瓦房店市| 通河县| 武邑县| 通渭县| 新巴尔虎右旗| 北宁市| 曲周县| 化德县| 苏尼特左旗| 东丽区| 建德市| 和平县| 沈丘县| 三穗县| 岳阳市| 余江县| 普宁市|