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

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.

主站蜘蛛池模板: 乌兰县| 大宁县| 洛南县| 阿拉善右旗| 白沙| 上思县| 兰溪市| 宁陕县| 克什克腾旗| 泸溪县| 广灵县| 鹿泉市| 富阳市| 玉门市| 南陵县| 察哈| 阿克苏市| 枞阳县| 政和县| 上犹县| 乳源| 南汇区| 新邵县| 上虞市| 澳门| 德令哈市| 读书| 民和| 太湖县| 阳曲县| 德江县| 尖扎县| 武宣县| 辽源市| 象山县| 铁岭县| 集安市| 桐乡市| 绥棱县| 乌鲁木齐县| 磐石市|