zoukankan      html  css  js  c++  java
  • Python 條件式 Condition

    除了重複使用Function,有時我們須檢查結果,依此判斷下個步驟該怎麼進行,如此就需要條件式 condition statement。

    if ... elif ... ese ( 或 if ... elif ...elif 或 if .. else )

    while

    >>> def numIsEven(k):
    ...    if k % 2 == 0:
    ...       print(k,' is even')
    ...    else:
    ...       print(k,' is odd')
    ...
    >>> numIsEven(8)
    8  is even
    >>> numIsEven(7)
    7  is odd

    /end

  • 相关阅读:
    12月4日
    12月3日
    12月2日
    12月1日
    11月30日
    11月29日
    11月28日
    11月27日
    jquery mobile-按钮控件
    ap web
  • 原文地址:https://www.cnblogs.com/chingchangmeng/p/11383958.html
Copyright © 2011-2022 走看看