Posted on

# Learn Python Episode #21: If, Elif, Else Statements

Get The Learn to Code Course Bundle!

Enroll in The Complete Python Course on Udemy!
https://www.udemy.com/python-complete/?couponCode=PYTHONWP

In this tutorial we are going to be learning about the conditional statements available to you in Python. So, we’re going to be learning about the if-else statement, and this is basically provides us a way to evaluate if something is true or false, and then perform something whether or not the condition is met. Let’s write an if-else statement.

`check = True`

```if check == False: print("It is false") else: print("It is actually equal to True")```

This is going to print out “It is actually equal to True” in the console. First, Python is going to check if the variable is equal to false. Else, it’s going to continue through the script and print, or perform, whatever we tell it to do. This is great if we only have two conditions, but what if we want to use more than two? Between the if and else we can use an elif statement, and here we can supply an additional condition.

`check = Hamburger`

if check == False:
print(“It is false”)
elif check == “Hamburger”:
print(“Yummm, hamburgers”)
else:
print(“It is actually equal to True”)

When we run this script it’s going check to see if the first condition is true, if not it will check the next condition, if not it will print the else statement. So, that’s what an if-statement is, and these are necessary for the project we are about to begin working on.

Subscribe – https://goo.gl/tkaGgy

## 3 thoughts on “Learn Python Episode #21: If, Elif, Else Statements”

1. Very interesting points you have remarked, appreciate it for putting up.

2. Write more, thats all I have to say. Literally, it seems as though you relied
on the video to make your point. You definitely know what youre talking about, why throw away your
intelligence on just posting videos to your site
when you could be giving us something enlightening to read?

3. Thanks to my father who shared with me regarding this blog, this webpage is
really awesome.