Python- relational operators
Hello Boys!
Good to reconnect with you.
Please look at the following Python Shell screen.
Thank you students!!
God Bless You
Computer Science Department
(Middle School)
Good to reconnect with you.
Today we are going to begin with the introduction of those topics, which will give an interesting turn to your journey of knowledge of programming.
| Learning Outcomes By the end of this blog you will be able to: * Elucidate Relational Operators * Understand the logic behind the Relational Operators |
Let's begin...
Have you ever taken any decision?
I am sure you must have.
Just think once... What do you need to do when there's a situation to take decision?
Before giving the answer just look at this video and find how is this man selecting the correct door.
I hope the video was enjoyable.
So did you notice, that as and when he got to know that there's a guard behind the door, he left it and selected another one.
So basically he compared two doors. One with guard and another without guard. Then he chose accordingly.
This is how we take our decisions... i.e. by Comparing.
Like if your friend tells you to check his result, then you will just compare his percentage with 33. If it is greater than or equal to 33, then you will inform him that HE IS PASS.
**************************************************************************
Such comparison is possible in Python too.
It is possible with the use of RELATIONAL OPERATORS:
These operators are useful in doing comparison. Therefore these are also known as comparison operators because they compare two values and return the Boolean value, i.e. either true or false.
Let us try to understand with a small example...
What will you say, if I ask that:
- Is 5 greater than 6?
Very much obvious answer... You will say NO.
Let's write the same thing in Python Language and see the answer:
The only difference is that the words 'GREATER THAN' are replaced by the symbol '>' and the word 'NO' is replaced by the value 'False'
This symbol ( > ) is also a Relational Operator in Python
******************************************************************
Let us understand all the Relational Operators one by one.
_____________________________________________________________________
>
- This is GREATER THAN operator.
- It returns 'True' if the value in its LHS is bigger/greater than the value in its RHS
- similarly, It returns 'False' if the value in its LHS is smaller than or equal to the value in its RHS.
_____________________________________________________________________
>=
- This is GREATER THAN OR EQUAL TO operator
- It returns 'True' if the value in its LHS is bigger/greater than or equal to the value in its RHS
- similarly, It returns 'False' if the value in its LHS is smaller than the value in its RHS.
_____________________________________________________________________
<
- This is LESS THAN operator.
- It returns 'True' if the value in its LHS is smaller than the value in its RHS
- similarly, It returns 'False' if the value in its LHS is greater than or equal to the value in its RHS.
_____________________________________________________________________
<=
- This is LESS THAN OR EQUAL TO operator.
- It returns 'True' if the value in its LHS is smaller than or equal to the value in its RHS
- similarly, It returns 'False' if the value in its LHS is bigger/greater than the value in its RHS
_____________________________________________________________________
==
- This is EQUALS TO operator.
- It returns 'True' if both LHS and RHS values are same/equal, otherwise 'False'.
_____________________________________________________________________
!=
- This is NOT EQUALS TO operator.
- It returns 'True' if both LHS and RHS values are not equal to each other, otherwise 'False'.
_____________________________________________________________________
Please look at the following Python Shell screen.
Just observe yourself to understand the behaviour of these operators.
Now fill the following form to assess your knowledge.
That's all for today...
Kindly finish your work before connecting to the next blog.
In our next blog we will start with the implementation of the RELATIONAL OPERATORS using IF Statements.
|
Thank you students!!
God Bless You
Computer Science Department
(Middle School)

Good morning maam
ReplyDeletethis question would be our first question of python
We had done relational operators last year. Now will take up the same from the point of view of Python statements----example IF
DeleteGood morning ma'am
ReplyDeleteAshwanth is present
10-C
Good morning ma'am
ReplyDeleteMatthew Jayakumar present
10 -C
We will have a GOOGLE MEET class tomorrow. I shall take up the exercise shared today and the next topic tomorrow. Kindly prepare accordingly.
ReplyDeleteWhat about this class ma'am
DeleteOk ma'am
ReplyDeleteGood morning
Present
Good morning ma'am.
ReplyDeleteGautam Gupta 10-C
Good morning mam
ReplyDeletePresent mam
Present maam
ReplyDeleteMa'am I couldn't find q 2,3,4 pls can you direct me
ReplyDeleteWhich blog??
Deletetoday's or last time's blog...
Last blog contained q1) and today's one contains q5) where are the middle ones. Please clarify
DeleteSorry. thats a typo error.
DeleteThis comment has been removed by the author.
DeleteGood morning ma'am
ReplyDeleteAdam Saviour Kerketta
is Present ma'am
Present Ma'am
ReplyDeleteArchbill Xalxo 10-C
Present Ma'am
ReplyDelete- George Gomes
Present ma'am
ReplyDeleteAdit Anand
X - C
Sanatan Ashish Hembrom is present 10-C
ReplyDeletePresent ma'am
ReplyDelete10C
Ma'am Jossam is Present
ReplyDeletepresent mam
ReplyDeleteTANISHQ PRESENT
ReplyDeleteKrish Kumar is present ma'am
ReplyDeleteDev shaurya present maam
ReplyDelete