Pythonのif文の説明と簡単な使用例
1013 ワード
#coding=utf8
print '''
python if :
if expression:
if_suite
---------------------------------------------------
0 True, if_suite 。
python 。
Python 。
'''
x=-0.1
# x 0,
if x< .0:
print "x must be at lest 0!"
print '''
Python else , :
if expression:
if_suite
else:
else_suite
---------------------------------------------------
Python elif(else-if) , :
if expression:
if_suite
elif expression:
elif_suite
else:
else_suite
---------------------------------------------------
'''
y=2
if y>3:
print "if the y great 3,print the value of y:" ,y
else:
print "the value of y:" ,y
z=5
if z>6:
print "if the z great 6,print the value of z" ,z
elif z== 5:
print "if the z equals 5,print the value of z:" ,z
else:
print "The valuas of z is :",z