Using else statement

Lesson Details:
September 17, 2020

Video Transcription: Now in this lecture we are going to learn about else statement this video is brought to you by Appy Pie’s Academy, so I'm going to go to this project then new and Python file give it any name suppose I am giving it as if - okay so this one is the same program that we have written in the previous lecture we have read the values of values of num1 and num2 but this time of work we will see what happens in case of this condition being false so we will be using else statement so I am giving the comment using else so I would write after this print statement else : so else shouldn't be indented like the previous one was so else : print num 2 is bigger than num 1 okay so as you can see this was the condition if num 1 greater than int num1 greater than int num2 if the condition is false then else statement will be performed and the message num 2 is bigger than 1 will appear I'm going to execute this program I am going to give the value of num1 as suppose 1000 and that of num2 900 as you can see the right message not 1 is bigger than num 2 is coming but I will re executive program and I will see that what happens if this condition is false I am going to give the value of num 1 as 10,000 that of num2 20,000 now as you can see now no 1 is not greater than num2 so condition is false the control will go to else and the message num 2 is bigger than num 1 will be that will be displayed on the screen.

Course content