Skip to content
MisakaTang's Blog
Go back

MIT_CS6.00笔记Lec1-3

Edit page

计算机科学及编程导论 Lec1.

什么是计算思维(computation)

知识:

计算机:

fixed-program computer: 固定程序用来做特定的运算
stored-program computer: 提供一系列的指令,计算机来执行这些指令(现代计算机模型)

program is a recipe: given a fixed set of primitives -> can program anything

讨论语言的三个维度:

Python: High,General,Interpreted

Syntax(语法): 什么是这种语言中的合法表达
Semantics(语义):

Lec2.

程序运行2种方式:

  • Interpret(直接解释)->eval&print

  • script(存储脚本)-> no print unless explict

    类型检查:

  • weak vs strong typing

    Typediscipline(代码规范)

  • A:检查运算符或程序来看他们在不同条件下做的操作是什么

  • B:约束参数的类型

    赋值

x = 3 + 5
y = 15

Variable used any place it’s legal to required

Statements(声明):

legal commands that Python can Interpret

直线式(顺序)程序:

按照顺序一条条代码执行

分支式(条件)程序:

改变程序执行的顺序通过一些条件Test(一般是变量的值)

Lec3.

流程图

防卫性程序

程序要覆盖所有的可能路径

Tuple: 一系列有序的元素的集合

foo=(1, 2, 3, 4)


Edit page
Share this post on:

Previous Post
MIT_CS6.00笔记Lec4-6
Next Post
LeetCode刷题--557. Reverse Words in a String III