+ 1
How is x < y ???
x = 'apircot' y = 'banana' if (x < y) and (x != 'apple'): print(' probably apircot')
4 Antworten
+ 3
Python compares string lexicographically i.e using ASCII value of the characters.
the ASCII value of the start character of x variable is 'a' = 95
and the ASCII value of the start character of y variable is 'b' = 96
So x < y is true
+ 3
This is also similar to the ordering of words in a dictionary.
+ 1
thanks for all the reposes guys