其他宣告
if condition:
body
else:
body
只有在前面的條件語句全部計算為 False 時,else 語句才會執行它的主體。
if True:
print "It is true!"
else:
print "This won't get printed.."
# Output: It is true!
if False:
print "This won't get printed.."
else:
print "It is false!"
# Output: It is false!