python学习_运算

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

 

posted @ 2018-04-14 22:07  年份原浆  阅读(163)  评论(0编辑  收藏  举报