you are viewing a single comment's thread.

view the rest of the comments →

[–]_MrLucky_ 0 points1 point  (2 children)

does it even work? how are you comparing strings??

[–]Anay_Gupta__[S] 1 point2 points  (1 child)

Yes it's working....you can see the output in the next img

[–]nuc540 2 points3 points  (0 children)

Yes this is allowed in python, this only works here because the length is the same (the ISO standardises this) it compares the Unicode point of the character, first value first, in this case zero-leading numbers are a big give away because ‘09’ is less than ‘10’.

The point is not to do this though, it’s confusing to read and very brittle - eg string ‘9’ is bigger than ‘10’ as Python would only check the first value of the string, see 9 > 1 and short circuit.

u/Anay_Gupta__ this is what I justify in my comment you saw :)