自學Python-09 分支與循環


自學Python-09 分支與循環


分支結構

  • 條件後面要加冒號
  • 使用縮進劃分語句塊
  • python沒有switch-case語句
自學Python-09 分支與循環

實例


自學Python-09 分支與循環


自學Python-09 分支與循環

循環結構

  • for in 語句與while語句
  • 語句後加冒號
  • 使用縮進劃分語句塊
  • python沒有 do…while語句
  • continue與break的使用
自學Python-09 分支與循環

while中使用break


自學Python-09 分支與循環

while中使用continue


自學Python-09 分支與循環

--------------------------------------------------------------------------


自學Python-09 分支與循環

for 中使用break,continue和while中的使用是一樣的


自學Python-09 分支與循環


自學Python-09 分支與循環


分享到:


相關文章: