Skip to content

Latest commit

 

History

History
33 lines (22 loc) · 563 Bytes

File metadata and controls

33 lines (22 loc) · 563 Bytes

IF

Python程序语言指定任何非0和非空(null)值为true,0 或者 null为false。

基本语法

if 判断条件:
    执行语句……
elif 判断条件3:
    执行语句3……
else:
    执行语句……

示例:

#!/usr/bin/python 
# -*- coding: UTF-8 -*-
 
var = 100 
 
if ( var == 100 ) : print("变量 var 的值为100") 
 
print("Good bye!")

注意 ⚠️ :在Python中没有 switch – case 语句

参考