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

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):

主站蜘蛛池模板: 江源县| 遵义市| 梁河县| 吉木萨尔县| 含山县| 子洲县| 六安市| 湘乡市| 沾益县| 探索| 陵川县| 桐城市| 滁州市| 宜黄县| 菏泽市| 邛崃市| 黑水县| 彭阳县| 温宿县| 曲麻莱县| 涞源县| 三穗县| 连平县| 长宁县| 双峰县| 永定县| 长春市| 和顺县| 乐清市| 威宁| 禄丰县| 岳阳县| 含山县| 汽车| 德格县| 论坛| 祁东县| 永仁县| 衡东县| 会宁县| 南江县|