Python Language Conditionals If statement

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

if condition:
    body

The if statements checks the condition. If it evaluates to True, it executes the body of the if statement. If it evaluates to False, it skips the body.

if True:
    print "It is true!"
>> It is true!

if False:
    print "This won't get printed.."

The condition can be any valid expression:

if 2 + 2 == 4:
    print "I know math!"
>> I know math!


Got any Python Language Question?