If Else Statement in Python | Python Tutorial

Published: 01 April 2021
on channel: Mahjabin Chowdhury
58
7

Assalamualaikum everyone.

In this video, I have discussed about if..else statement in python.
If else statement is a conditional statement.

In my previous video, I have discussed about if statement in python. If you are watching this video, I would highly recommend you to watch my previous part of this video to have a better understanding of if statement or conditional statement in python.

If statement is a conditional statement used to execute a certain block of code if a particular condition is satisfied.
If..else statement is a conditional statement used when there are multiple blocks of codes. And we can execute certain statements if condition is true and can also execute other statements if the condition is false.

Basically, if we use only if statement, we can execute a block of code only if the condition is satisfied.

But if..else statement allows us to execute either condition is satisfied or not satisfied.

If..else statement basically extends the if statement.


Below is the syntax of if..else statement:

if condition:
code1
else:
code2

Code1 gets executed if the given condition is True.
Code2 gets executed if the given condition is False.

In my video I have showed how you can execute a program which includes using if else statement. Watch the full video guys, so you can understand everything properly.

Thank you so much for being with me. Till we code again.


On this page of the site you can watch the video online If Else Statement in Python | Python Tutorial with a duration of hours minute second in good quality, which was uploaded by the user Mahjabin Chowdhury 01 April 2021, share the link with friends and acquaintances, this video has already been watched 58 times on youtube and it was liked by 7 viewers. Enjoy your viewing!