官术网_书友最值得收藏!

Boolean

A boolean variable can have one of two values: true or false. Booleans are often used to control the flow of code and express logic. This code assigns the Boolean value of true to the variable foo, then prints this value:

foo = true
print ("The value of foo is:")
print (foo)

A more useful example of a Boolean is to obtain it from some kind of logical operation, for example, to check whether five is greater than three or not. This code demonstrates how to do this:

result = 5 > 3
print ("Is 5 > 3?")
print (result)
主站蜘蛛池模板: 吉林市| 玛曲县| 晋中市| 保山市| 加查县| 乐至县| 应城市| 巴林左旗| 元江| 商城县| 苍南县| 江门市| 东港市| 化德县| 安塞县| 高青县| 盐边县| 大同市| 汝城县| 莎车县| 集安市| 博兴县| 仁怀市| 峨山| 清水河县| 曲阜市| 罗源县| 平果县| 谢通门县| 盐山县| 依安县| 沂水县| 庆云县| 岳阳市| 广丰县| 民权县| 淮安市| 肥乡县| 左云县| 疏勒县| 桂平市|