0
how in boolean "banjoi" < "sanjo" returns true?
banjoi has 6 letters while sanjo has only 5
7 ответов
+ 6
It compares the ASCII code of the first character(letter) in words
b=98
s=115
So s>b
So it returns True
If the first character is the same , it compares second character(and so on)
so 'su'<'sv'
You can get the ASCII code of a letter using ord()
eg: ord("a") would give 97
And the letter associated with ASCII code can be retrieved using chr()
eg: chr(100) would give "c"
capital letters come before simple letters in ASCII table
so "S"<"s"
ASCII table is available in http://www.asciitable.com/
or Google it 😀
+ 5
it's because 'b' comes bevore 's'
+ 1
alphabetically, "banjoi" comes before "sanjo" therefore it is the lesser of the two.
+ 1
great explanations thanks guys
0
if u want compare lenghts: len("banjoi")<len("sanjo")
0
run by dictionary
- 1
сложнаа