How to use shorthand if in Python?

Python enables developers to write the if statement in just a single line. But the only caveat is that you must have only one statement or expression to execute.

The format of shorthand if is:

if condition: statement

Shorthand if Example

a = 20
b = 15
if a>b: print("a is maximum.")


a is maximum.