PyThon3运算符

代码:

data1 = 7
data2 = 3
print("--------------------------------")
print(data1+data2)
print(data1-data2)
print(data1*data2)
print(data1**data2)
print(data1/data2)
print(data1//data2)
print(data1%data2)
 
print("--------------------------------")
data1 += data2      # - * / % **
print(data1)
 
print("--------------------------------")
print(data1 == data2)  # != > < >= <=
 
print("--------------------------------")
print(True and False)
print(True or False)
print(not False)

运行结果:

--------------------------------
10
4
21
343
2.3333333333333335
2
1
--------------------------------
10
--------------------------------
False
--------------------------------
False
True
True
 

 

posted @ 2019-09-10 22:03  Jumpkin1122  阅读(159)  评论(0编辑  收藏  举报