一、if语句
#!/usr/bin/python
n = 100
if ( n == 100 ) :
print ('right')
print ("exit!")
运行结果
二、if-else语句
#!/usr/bin/python
num=100
if num > 100:
print ('right')
else:
print ('wrong')
运行结果
三、if-elif-else
#!/usr/bin/python
num = 70
if num >=0 and num <= 10:
print ('num inside 0~10')
elif num <=20:
print ('num inside 11~20')
elif num <=30:
print ('num inside 21~30')
elif num <= 50: