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