String Comparison In Python

0
65

string comparison in python: The string comparison technique allows us to compare weather two strings are same or not. As we know python is Sensitive language. The variables MyVar and myVar are completely different.

Using the comparison operators, string comparison in python is too easy.

  • == Equals to
  • != Not Equals
  • >= Greater or Equal
  • <= Lesser or Equal

As python is case sensitive, the strings “Rexoxer” and “rexoxer” are completely different.

Var1 = “Rexoxer”
Var2 = “rexoxer”
print (Var1 == Var2,end=’ ‘)
print (Var1 != Var2,end=’ ‘)
print (Var1 >= Var2,end=’ ‘)
print (Var1 <= Var2)

LEAVE A REPLY

Please enter your comment!
Please enter your name here