Is '2' > '10'
? What is the output if we compare two integers which are converted to string format?
I am getting true but it's false, right?
Is '2' > '10'
? What is the output if we compare two integers which are converted to string format?
I am getting true but it's false, right?
When comparing strings, you compare them lexicographically. The character 2
comes after the character 1
, so the result is True
. The fact that these two strings could be converted to integers is inconsequential.