python学习_运算

python学习网 2018-04-15 10:52:12

1.数据类型

1.1数字

整型int,如2

浮点型float,如3.14和314E-2

复数complex,如(-5+4)

1.2布尔值

真或假

1或0

1.3字符串

'hello world'

2.数据运算

http://www.runoob.com/python/python-operators.html

3.三元运算

 1 result = 值1 if 条件 else 值2 

如果条件为真:result = 值1
如果条件为假:result = 值2

 

阅读(764) 评论(0)