亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

總結Python中邏輯運算符的使用

系統 2125 0

下表列出了所有Python語言支持的邏輯運算符。假設變量a持有10和變量b持有20,則:

總結Python中邏輯運算符的使用_第1張圖片

?示例:

試試下面的例子就明白了所有的Python編程語言提供了邏輯運算符:

            
#!/usr/bin/python

a = 10
b = 20
c = 0

if ( a and b ):
  print "Line 1 - a and b are true"
else:
  print "Line 1 - Either a is not true or b is not true"

if ( a or b ):
  print "Line 2 - Either a is true or b is true or both are true"
else:
  print "Line 2 - Neither a is true nor b is true"


a = 0
if ( a and b ):
  print "Line 3 - a and b are true"
else:
  print "Line 3 - Either a is not true or b is not true"

if ( a or b ):
  print "Line 4 - Either a is true or b is true or both are true"
else:
  print "Line 4 - Neither a is true nor b is true"

if not( a and b ):
  print "Line 5 - Either a is not true or b is not true"
else:
  print "Line 5 - a and b are true"


          

當執行上面的程序它會產生以下結果:

            
Line 1 - a and b are true
Line 2 - Either a is true or b is true or both are true
Line 3 - Either a is not true or b is not true
Line 4 - Either a is true or b is true or both are true
Line 5 - Either a is not true or b is not true


          


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 午夜欧美精品久久久久久久 | 国产视频一区二区在线播放 | 搡的我好爽视频在线观看 | 久久国产视频网 | 亚洲精品国产一区二区三 | 亚洲精品国产精品一区二区 | 国产主播福利在线 | 日韩毛片免费 | 欧美精彩狠狠色丁香婷婷 | 日本一级毛片片在线播放 | 国产精品麻豆高清在线观看 | 亚洲国产人久久久成人精品网站 | 久久成人亚洲 | 国产午夜精品福利 | 欧美色xxx| 国产成人一区二区三区在线视频 | 久久99视频免费 | 亚洲欧美精选 | 久久久久国产成人精品 | 久久免费视频播放 | 97视频在线免费播放 | 天天综合网天天综合色不卡 | 国产精品21区 | 日韩福利影院 | 日本a∨在线 | 免费国产黄线在线观看视频 | 伊人情人综合 | 在线欧美v日韩v国产精品v | 国产欧美日韩图片一区二区 | 蜜桃久久 | 伊人国产精品 | 亚洲综合色区图片区 | 本地毛片| 四虎8848精品永久在线观看 | 超级97碰碰碰碰久久久久最新 | 久久久精品免费国产四虎 | 狠狠色香婷婷久久亚洲精品 | 亚洲图区欧美 | 天天操天天射天天操 | 午夜按摩 | 五月婷婷开心中文字幕 |