What is correct syntax of Python if statement?

PythonServer Side ProgrammingProgramming

In Python, if keyword is used to execute on or more statements conditionally. The keyword is followed by a logical expression and : symbol. A block of increased indent containing one or more statements (stmt1 and stmt2 in following illustration)  is executed if the expression evaluates to true. If it is not true, statements if any (stmt3 below) after the indented block get executed.

if expr == True:
    stmt1
    stmt2
stmt3
raja
Published on 14-Feb-2018 13:58:42
Advertisements