+ 1
if condition:
Do something
else:
Do something else
After the word 'if' there must be a condition. This is a true or false statement.
For example,
if 1 == 1:
This is true, which means any code that is 'inside' this will run. In this case, 'do something' will run, as indicated by the indent, being 'inside' the if statement.
The else is what will occur when the condition is false.
If I had: 1 == 2:
Then the code inside the else statement will run instead.
So, you use the if/else statements when you want some code to run conditionally. Only under some specific circumstance.