Python If Condition Using Shorthand Example


  • If statement

It executes if block only when if condition is true.

In shorthand, it can also be written as

Program
a = 9 b = 7 if a > b: print("a is greater than b")
Input
Output