if - else statements in Python
If - else statements in Python
Let's first have a look on Question
- Now, in this question we have to use some Operator ( Logical ).
- Following 6 Logical operator-
And all other operator will be discussed in Python on Android Python
Let's understand if-elif with an example -
- First, the program will start from Line 3 ( if b>a ) and if the statement ( b>a ) comes True ,it will print b is greater than a .
- But in our case it is false.
- So, the cursor will move to Line No. 5 (a==b) and if statement found True it will show a and b are equal.
- And that's our Answer !!
- And elif statement seem false it will move to else statement (which don't contain any operation. It will print what is in print statement after else statement indentation.
Output
Now moving towards our Real question.
Code -
That's our code .. !! Hope it is Easy for you.
Comments
Post a Comment