第六节 运算符优先级

运算符优先级

下表按照运算符优先级从高到低的顺序列出

有括号先算括号里面的

alt 运算符优先级

print("5 + 2 * 2 = ",5 + 2 * 2)
print("5 - 2 * 2 = ",5 - 2 * 2)
print("5 + 2 / 2 = ",5 + 2 / 2)
print("5 - 2 / 2 = ",5 - 2 / 2)

运行结果:

alt 运算符优先级

results matching ""

    No results matching ""