Why print("a"<"z") return True in python, explain please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why print("a"<"z") return True in python, explain please

3rd May 2020, 5:02 PM
5152Vignesh .A
5152Vignesh .A - avatar
2 Answers
+ 9
Because strings are converted to their respective Unicode values. And "z" unicode value is greater than "a" hence it prints True.
3rd May 2020, 5:15 PM
Viren Varma
Viren Varma - avatar
+ 3
Here ascii code is compared and ascii code of "a" is 97 and "z" is 122 Hence it's returns True
3rd May 2020, 5:13 PM
ANJALI SAHU