为什么1 << 3 + 1 << 4 = 256?

问题描述

我认为它将等于1

python interpreter

解决方法

这是因为python的运算顺序,其中加法运算在左移运算符之前进行。该表达式等效于

(1<<(3+1))<<4