输入输出
localhost:Python clear$ python3
Python 3.6.0 (default, Mar 16 2017, 16:06:39)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> name = input()
cc
>>> name
'cc'
>>> exit()
数据类型和变量
>>> a = 100
>>> if a >= 0: print(a)
...
100
>>> a = 'i\'m ok'
>>> print(a)
i'm ok
>>> true
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'true' is not defined
>>> True
True
>>> True and True
True
>>> True or False
True
>>> None
>>> a = 123
>>> print(a)
123
>>> a ="ss"
>>> print(a)
ss
>>> 10/3
3.3333333333333335
>>> 9/3
3.0
>>> 10//3
3
>>> 10%3
1
>>>