Python Lesson 3 (if/else condition) # Python Lesson 3 (if/else condition)

Thank you for joining with my third tutorial of python language, if/else condition. Before we get started today’s lesson, I must say that you have taken the right choice to learn python. Because python is one of the best programming languages you can learn. Python can be used to code any kind of application. Python can be use to code web applications to complex network apps and process big data. So lets learn the basics first before we get the deep knowledge.

With this lesson, Im going to teach you about the simple conditions. Lets take an example. Lets say we have two variables. We will call the first variable as “a” and we will call the second one as “b”. Then we will assign two values to it. After that we are going to check the larger value using python.

```a = 33
b = 200```
##### Now we will code the if statement.
```if b > a:
print("b is greater than a")
```

Now, python will print “b is greater than a”, Because value of  “b”  is larger than the value of  “a”.  But if the “a” became larger than “b”, nothing will print. So, lets see how to code the else part.

```if b > a:
print("b is greater than a")
else :
print("a is greater than b")```

Now, when the “a” became larger than “b”, python will print “a is greater than b”. Now we will see how to use more than cone condition. To do it, we have to use “elif “. Have a look at this example.

```a = 200
b = 33
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
else:
print("a is greater than b")```

As you can see here, we are using more than one condition. First we are checking whether “b” is larger than “a” or not. Then i am checking “a” is equal to “b”. This is how we can use conditions. You can use more than one “elif’ inside a if/else condition. So, this is the end of today’s tutorial. Lets learn about arrays using my next tutorial. Feel free to contact me if you have any other issues. Feel free to share this with your friends. Have a nice day.