1. 实现整除的操作--双斜线,就算是浮点数,也会执行整除操作。
2. 幂(乘方)运算符-- **,它的优先级比取反(一元减)运算符高。
3. input的简单使用
>>> x = input("input x:")
input x:3
>>> y = input("input y:")
input y:4
>>> x*y
12
4. import命令,用于导入模块
>>> import math
>>> math.floor(29.3)
29.0
不希望每次调用函数时都写上模块名
>>> from math import sqrt
>>> sqrt(16)
4.0
也可以引用变量来实现
>>> foo=math.sqrt
>>> foo(16)
4.0
5. str和repr的区别
>>> print repr("Hello, word!")
'Hello, word!'
>>> print repr(10000L)
10000L
>>> print str("Hello, world!")
Hello, world!
>>> print str(10000L)
10000
>>> tmp=42
>>> print "The temperature is "+repr(tmp)
The temperature is 42
6.input和raw_input的区别
>>> input("Enter a number:")
Enter a number:3
3
>>> raw_input("Enter a number:")
Enter a number:3
'3'