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

Understanding boolean expressions

Boolean expression syntax is a little bit weird or unusual, at least in Python:

print (1 == 3)

The output of the above code is as follows:

False

As usual, we have the double equal symbol that can test for equality between two values. So does 1 equal 3, no it doesn't, therefore False. The value False is a special value designated by F. Remember that when you're trying to test, when you're doing Boolean stuff, the relevant keywords are True with a T and False with an F. That's a little bit different from other languages that I've worked with, so keep that in mind.

print (True or False)

The output of the above code is as follows:

True

Well, True or False is True, because one of them is True, you run it and it comes back True.

主站蜘蛛池模板: 泾阳县| 丽江市| 南投市| 靖宇县| 博湖县| 双峰县| 太仆寺旗| 嘉义市| 龙江县| 新宁县| 额敏县| 呼玛县| 乳山市| 永仁县| 娄底市| 滕州市| 田阳县| 油尖旺区| 潜山县| 西平县| 雷山县| 瑞昌市| 抚顺县| 睢宁县| 灌南县| 微博| 南皮县| 维西| 基隆市| 沅陵县| 沂水县| 宁安市| 岱山县| 舒兰市| 高尔夫| 汕尾市| 禹城市| 湾仔区| 石阡县| 延津县| 北辰区|