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

- Spring 5.0 Microservices(Second Edition)
- Android和PHP開發最佳實踐(第2版)
- 微服務與事件驅動架構
- Instant Zepto.js
- HTML5+CSS3網站設計教程
- Oracle Database 12c Security Cookbook
- Julia Cookbook
- SQL Server 2016數據庫應用與開發習題解答與上機指導
- 深入淺出PostgreSQL
- Apache Kafka Quick Start Guide
- Instant Ext.NET Application Development
- C/C++程序員面試指南
- C++ Fundamentals
- Java Web開發實例大全(基礎卷) (軟件工程師開發大系)
- Python+Office:輕松實現Python辦公自動化