gpt4 book ai didi

python - 为什么 5^(4-4) + 9 和 (5^(4-4)) + 9 的结果不同?

转载 作者:太空宇宙 更新时间:2023-11-04 07:53:14 25 4
gpt4 key购买 nike

我很好奇python中两次计算的不同结果

5^(4-4) + 9 = 12

(5^(4-4)) + 9 = 14

请解释区别。

最佳答案

这是运算符优先级的问题。

+^ 具有更强的绑定(bind)。

优先级已记录 here .

关于python - 为什么 5^(4-4) + 9 和 (5^(4-4)) + 9 的结果不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52175600/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com