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

The if...else condition

The if...else condition is pretty much the same as in any other language. If the if condition evaluates to a True value, the code block indented under if is executed. Otherwise, the code block indented under the else block is executed:

a=44
b=66
if a > b:
print("a is Greater")
else:
print("B is either Greater or Equal")
print("End")

Let's create a file called if_else.py and see how to use it:

Again, the output here is self-explanatory. In this section of code, we explored the usage of some bitwise operators alongside the if...else code structure. We also used variables, which are to be printed with the print method. %s is a placeholder, and specifies that the value of %s should be replaced by a string variable whose value would come immaterially after the string ends. If we have multiple values to substitute, they can be passed as a tuple such as %(val1,val2,val3):

主站蜘蛛池模板: 平凉市| 星座| 奉贤区| 东丰县| 天全县| 冕宁县| 灵山县| 隆子县| 宣化县| 汉中市| 嘉禾县| 新化县| 呼伦贝尔市| 莲花县| 澄江县| 平武县| 武乡县| 桂阳县| 鄂托克前旗| 资溪县| 淮阳县| 高雄市| 岳普湖县| 梧州市| 秦安县| 合作市| 丹凤县| 龙泉市| 江永县| 肥西县| 洛浦县| 两当县| 丰都县| 安达市| 巩义市| 济南市| 龙州县| 乐平市| 浑源县| 日土县| 凤台县|