- Hands-On Penetration Testing with Python
- Furqan Khan
- 162字
- 2021-07-02 14:13:53
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):

- 深入理解Django:框架內(nèi)幕與實(shí)現(xiàn)原理
- 網(wǎng)頁(yè)設(shè)計(jì)與制作教程(HTML+CSS+JavaScript)(第2版)
- Learning SQLite for iOS
- Processing互動(dòng)編程藝術(shù)
- Apex Design Patterns
- Android移動(dòng)開(kāi)發(fā)案例教程:基于Android Studio開(kāi)發(fā)環(huán)境
- Elasticsearch Blueprints
- Puppet 5 Beginner's Guide(Third Edition)
- 零基礎(chǔ)學(xué)Java(第5版)
- INSTANT Lift Web Applications How-to
- Building an E-Commerce Application with MEAN
- Python3從入門(mén)到實(shí)戰(zhàn)
- 高性能Scala
- Mastering JavaScript Design Patterns
- Unreal Engine Lighting and Rendering Essentials