“Python/gloss python if nested”的版本间差异

来自菜鸟教程
跳转至:导航、​搜索
(Pywikibot 4.4.0.dev0)
 
(机器人:添加分类Python基础教程
 
第57行: 第57行:
 
</div>
 
</div>
 
<br />
 
<br />
 +
 +
[[分类:Python基础教程]]

2020年10月29日 (四) 08:48的最新版本

<languages />

Python嵌套If

如果里面如果

你可以有 if 里面的陈述 if 声明,这称为 nested if 声明。

  x = 41

if x > 10:

     
    print("Above ten,")
  if x > 20:
    print("and 
  also above 20!")
  else:
    print("but not 
  above 20.")