0

Wy „7“ > „10“ is True?

I dont get it. wy the Output is ‚seven is more‘? if "7" > "10": print(("seven is more"))

27th Feb 2020, 8:07 PM
Andreas
2 odpowiedzi
+ 6
They are compared as words are compared in a dictionary - lexically. That's because they model language mainly and are supposed to behave like language. In a dictionary, 10 would come before 7 (just as 'and' comes before 'by'), so it's smaller. If you want to know more, google the ASCII table and the unicode order.
27th Feb 2020, 8:10 PM
HonFu
HonFu - avatar
+ 1
thanks!
27th Feb 2020, 8:17 PM
Andreas