Selection

In most computer programs, there are certain points where a decision must be made. This decision is based on a condition, and that condition can be either true or false.

If statements are used if a decision is to be made.

if num >= 70: 
     print(“You're Passed!”) 
else:
     print(“You've Failed!”)

If the condition is true, then the if statement will execute the first block of code

video

If the condition is false, the if statement will execute the ‘else’ block of code if included.

video

Read page 43 – 46 of the textbook “Python for Beginners”.