educative.io

String operations returning a bool value

Hi team,
So , when there is a variable named new_house = ’ Slytherin’ and another variable named house = ‘Gryffindor’, and there is a print statement , print (new_house<=house) returning False, is this returning false on the basis of the sentence’s summation of unicode value? Can anyone please explain this.

Thanks and Regards
Ankan

Hello @Ankan_Chanda,
It does not work on the like summation of the Unicode value of the complete string. It compares the string index by index. Suppose we have two strings house = "ayyy" and new_house = "bzzz". The result of the print(new_house >= house) will be True.
I hope this helps.
Thank you.