官术网_书友最值得收藏!

if...else

The if-statement supports an optional else clause which goes in a block introduced by the else keyword (followed by a colon) which is indented to the same level as the if keyword. Let's start by creating (but not finishing) an if-block:

>>> h = 42
>>> if h > 50:
... print("Greater than 50")

To start the else block in this case, we just omit the indentation after the three dots:

... else:
... print("50 or smaller")
...
50 or smaller
主站蜘蛛池模板: 丹棱县| 洞口县| 沁阳市| 新昌县| 岗巴县| 宿迁市| 梅州市| 沙田区| 连云港市| 梁山县| 信阳市| 新龙县| 股票| 兴城市| 汝阳县| 大丰市| 浦县| 淮阳县| 铜梁县| 徐闻县| 佛冈县| 垫江县| 罗源县| 集安市| 新化县| 潍坊市| 夏津县| 娱乐| 津市市| 蓬莱市| 邳州市| 崇文区| 始兴县| 柳林县| 集贤县| 新和县| 武宣县| 定兴县| 成武县| 永寿县| 富锦市|