python6
python6
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=36b50c7e-806a-4834-859f-1c031bdf9942&s_id=6e7a0638… 1/5
7/27/24, 8:58 PM Revolutionizing the Job Market | NxtWave
Relational Operators
Relational Operators are used to compare values.
Gives
Operator Name
== Is equal to
!= Is not equal to
Code
PYTHON
Output
True
True
Possible Mistakes
Mistake - 1
Code
PYTHON
1 print(3 = 3)
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=36b50c7e-806a-4834-859f-1c031bdf9942&s_id=6e7a0638… 2/5
7/27/24, 8:58 PM Revolutionizing the Job Market | NxtWave
Output
Mistake - 2
Code
PYTHON
1 print(2 < = 3)
Output
Comparing Numbers
Code
PYTHON
1 print(2 <= 3)
2 print(2.53 >= 2.55)
Output
True
False
Code
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=36b50c7e-806a-4834-859f-1c031bdf9942&s_id=6e7a0638… 3/5
7/27/24, 8:58 PM Revolutionizing the Job Market | NxtWave
PYTHON
1 print(12 == 12.0)
2 print(12 == 12.1)
Output
True
False
Comparing Strings
Code
PYTHON
1 print("ABC" == "ABC")
2 print("CBA" != "ABC")
Output
True
True
Case Sensitive
Code
PYTHON
1 print("ABC" == "abc")
Output
False
X (Capital letter) and x (small letter) are not the same in Python.
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=36b50c7e-806a-4834-859f-1c031bdf9942&s_id=6e7a0638… 4/5
7/27/24, 8:58 PM Revolutionizing the Job Market | NxtWave
1 print(True == "True")
2 print(123 == "123")
3 print(1.1 == "1.1")
Output
False
False
False
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=36b50c7e-806a-4834-859f-1c031bdf9942&s_id=6e7a0638… 5/5