Home
Python Tutorial
Introduction
Data Type
Statement
Operator
String
Tuple
List
Dictionary
Collections
Function
Class
File
Buildin Function
Buildin Module
Database
Regular Expressions
Thread
Tkinker
wxPython
XML
Network
CGI Web
Windows
If Statement : if « Statement « Python Tutorial
Python Tutorial
Statement
if
if
1 == 2: print
'One equals two'
if
1 == 1: print
'One equals one'
3.1.if
3.1.1.
The if statement is used for conditional execution, and it may include elif and else clauses.
3.1.2.
A typical if statement with all three kinds of clauses:
3.1.3.
If Statement
3.1.4.
using an if-else statement
3.1.5.
else Clauses
3.1.6.
elif Clauses
3.1.7.
Nesting Blocks
3.1.8.
Using if statements, relational operators and equality operators to show improper indentation.
3.1.9.
Use if statement to compare string