MIT6.00x Week1
-
binding variables and values
In this section, each values were stored in the computer memory,besides,in computer it also have a variables list,each one are bind with a value.
If a variable was be gave a number before, then you change it's composition,the result before may not change。For example,When we calculate the area,in the frist time,the answer is 10.0,but after calculating,I change the radius to another value ,the area will not change
-
int
-
float
-
bool
-
NoteType
-
string
-
if elif else
-
while control the flow
n = 0
while n<1
print(n)
n = n+1
-
for loop
for n in range(3):
...
WHAT DOES A COMPUTER DO
- calculation
- remember result
TYPES OF KNOWLEDGE
- declarative knowledge
statements of fact.陈述事实
- imperative knowledge
a recipe or “how-to” knowledge
一个东西具体怎么做
BASIC MACHINE ARCHITECTURE

SCALAR OBJECTS 标量
- int
- float
- bool
- NoneType
- 可以使用type()获取对应的类型
- 强制转换,int(3.4)
OPERATORS ON ints and floats
-
-
-
- /
- // ---int division整数除法
- % mod
- ** pow
COMPARISON OPERATORS ON int and float
- i>j
- i<j
- i>=j
- i<=j
- i==j
- i!=j
BRANCHING PROGRAMS
x = int(input('Enter an integer: '))
if x%2 == 0:
print(‘’)
print('Even')
else:
print(‘’)
print('Odd')
print(’Done with conditional')
LOGIC OPERATORS ON bools
- not a
- a and b
- a or b
vacabulary
- scalar 标量
- proportions 比例
- components 成分
- concatenated 串联
- prompt 促使
- conon 冒号
- metaphors 隐喻
浙公网安备 33010602011771号