钱闻韬 发表于 2018-9-9 20:22:14

具体是什么意思没搞懂

not 1 or 0 and 1 or 3 and 4 or 5 and 6 or 7 and 8 and 9 答案为什么是4???{:5_94:} {:5_94:} {:5_94:}

钱闻韬 发表于 2018-9-9 20:24:25

小甲鱼答案有点绕Python

冬雪雪冬 发表于 2018-9-9 20:47:40

not 1 or 0 and 1 or 3 and 4 or 5 and 6 or 7 and 8 and 9
not优先级最高,先运算,not 1 ---> 0
0 or 0 and 1 or 3 and 4 or 5 and 6 or 7 and 8 and 9
and优先级次高,两者都为真时为真,所以 0 and 1 第一个为False,所以就去第一个的值,3 and 4 都为真,取第二个值
0 or 0 or 4 or 6 or 9
0 or 0 为假,取值0, 0 or 4,只要一个为Tue就为True,取第二个值4,4 or 6,去第一个值4

claws0n 发表于 2018-9-9 20:51:44

https://fishc.com.cn/forum.php?mod=viewthread&tid=120601&highlight=%C2%DF%BC%AD

钱闻韬 发表于 2018-9-9 20:57:27

claws0n 发表于 2018-9-9 20:51
https://fishc.com.cn/forum.php?mod=viewthread&tid=120601&highlight=%C2%DF%BC%AD

pheron 发表于 2018-9-13 10:17:46

在我们的逻辑运算里,结果=1......或许这就是硬件与软件的不同吧.............

zhangfu0021 发表于 2018-9-13 15:32:35

优先级 not > and >or相同的逻辑运算符从左到右    not 1 or 0 and 1 or 3 and 4 or 5 and 6 or 7 and 8 and 9   ->(先算not)not 1= flase   -> (得到)flase or 0 and 1 or 3 and 4 or 5 and 6 or 7 and 8 and 9->(再算and) 0 and 1 =0 ;3 and 4 = 4;5 and 6 = 6;7 and 8 and 9 = 9 ->(得到)flase or 0 or 4 or 6 or 9 ->最后算 or得到的结果为 4(注:flase 可以看做 0)   pyton计算看图:

钱闻韬 发表于 2018-9-14 13:52:26

页: [1]
查看完整版本: 具体是什么意思没搞懂