猫史档案馆


【一道世界难题(伪)】过来试试吧!

用户:宇宙之初宇宙之初查看:1 回复:5 评论:1 创建时间:2018-11-15T15:47:47


Python中的7个运算符:(ret是返回值的意思)

not

  ret = not 条件,not的结果和"条件"的值相反

or,

  ret = left or right,只要有一个值为True,or的结果就是True

and

  ret = left and right,只要有一个值为False,and的结果就是False

not or

  ret = not(left or right), 只有left和right有一个为True时,not or的结果就是False

not and

  ret = not(left and right),只有left和right有一个为False时,not and的结果就是True

!=

  ret = left != right,left和right的值不相等,!=的结果就是True

==

  ret = left == right,left和right的值相等,==的结果就是True

 

优先级关系:or<and<not

同一优先级默认从左往右计算

 

上题目:

 

(True and not (False and (True and False)))or ('True' == 'False') and ((not (not (123+456 == '579') or not (True == False) and (True and False)) or ('Python' != 'Pythen')) or not(True and True)) and (('tttttt' == 'ttttt') or (True or (not False)))

 

 

 

PS:不准作弊,如果实在不会,先留言“不会”把上面代码复制到Python的IDLE中,回车。


回复

上一页1 页 / 共 1下一页
宇宙之初宇宙之初

计算是True或者False

点赞0


评论


宇宙之初宇宙之初

上答案:

center_image

 

点赞0


评论


离开的十五分之六老咸鱼离开的十五分之六老咸鱼

这字体真六,哪里下的

点赞0


评论


宇宙之初宇宙之初

用FontCreator做的

点赞0


评论


浮躁的飓风雀HYKa浮躁的飓风雀HYKa

True

点赞0


评论