+ 1
Boolean logic ? Explain ?
cat_1 = "CatF" cat_2 = "CatD" bool = cat_1 > cat_2 if bool==True: print("fatcat") else: print("deadcat")
4 Antworten
+ 1
Strings are checked lexicographically so 8n cat_1>cat_2, "CatF" >"CatD" upto " Cat" is but 'F' >'D' is true I.e Ascii of 'F' > Ascii 9f 'D' so it returns true finally....
0
Jayakrishna🇮🇳 thank you ; ) I didn't know about that
0
Manish Kumar you're welcome.
Just know about 'lexicographically sorting'.. You can find it clearly...
0
It compares unicode numbers of the letters with same index