IKH

Equality Operators

  • == ⇒ Equal
  • != ⇒ Not equal

Remark

  • These operators can apply for any type even for incompatible types also.
  • These operators compare content of the variable.

Example

Python
print(10 == 20)
print(10 != 20)
print(10 == True)
print(False == False)
print("ajay" == "ajay")
print(10 == "ajay")

Output

PowerShell
False
True
False
True
True
False

Remark

  • Chaining concept is also applicable for equality operators. If at-least one comparison returns false then the result is False. otherwise the result is True.

Example

Python
print(10 == 20 == 30 == 40)
print(10 == 10 == 10 == 10)

Output

PowerShell
False
True

Ungraded Questions

Get ready for an exhilarating evaluation of your understanding! Brace yourself as we dive into the upcoming assessment. Your active participation is key, so make sure to attend and demonstrate your knowledge. Let’s embark on this exciting learning journey together!