说点什么吧~
Python
Interpreted (√) VS. compile
Operation
+ - * /
>>>'a'*3'aaa'>>>3/50>>>3**327
Variables
>>> a = 3>>> print a3
Operators and operands
>>> 'ab' + 'c''abc'>>> 3 + 'c'Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'>>> str(3) + 'c''3c'
>>> 'a' < 3False>>> 4 + '3'True>>> 9/51>>> 9%54>>> 3+4*523
type of Variables--get from value
Dynamic types 动态类型
x = ‘abc’
don’t change types arbitrarily 不要反复无常的改变变量类型
Variables used any place it’s legal to use value
statements
branching 分支
冒号: start
carriage 回车 is end
x = 15if(x/2)* 2 == x: print 'Even'else: print 'Odd'
conditionals 条件
# if语句可嵌套if <some test> :
Block of instructions.else:
Block of instructions.
iteration 迭代 or loops 循环
# y = x的平方y = 0x = 3itersLeft = xwhile(itersLeft>0) :
y = y + x
itersLeft = itersLeft -1print y
说点什么吧~
欢迎来到学堂在线广场~
在这里你可以玩活动,看资讯,晒笔记。
还可以交学友、发心情、聊人生。
在学堂的每一天,就从这里开始吧!
点击 广场指南 了解更多