+ 3

Cat < dog

if('cat'<'dog'): print("true") why it return true ? how?

1st Feb 2017, 3:40 PM
Shiva M
Shiva M - avatar
8 Antworten
+ 7
because ASCII value of 'c' is 3 and and 'd' is 4 ...hence 3<4 ..which is true
1st Feb 2017, 3:58 PM
Pankaj Vaghela
Pankaj Vaghela - avatar
+ 3
it compares the ASCII values hence it returns true
1st Feb 2017, 6:07 PM
Devanshu Maratha
Devanshu Maratha - avatar
+ 1
because ASCII value of 'c' is 3 and and 'd' is 4 ...hence 3<4 ..which is true
18th Feb 2017, 12:04 PM
divyanshu verma
0
Apples != Oranges
1st Feb 2017, 5:36 PM
Matthew Waldeck
Matthew Waldeck - avatar
0
'Apples' != 'Oranges' and 'Apples' < 'Oranges' It compares the characters of both strings by their ASCII values (might be UTF-8 values)
1st Feb 2017, 10:28 PM
Amaras A
Amaras A - avatar
0
Orange like annoying orange hahahaha
1st Feb 2017, 11:25 PM
halobeastking
0
thank so if we conditional check 2 character it checks ASCII values and return value
2nd Feb 2017, 2:38 AM
Shiva M
Shiva M - avatar
0
I think the problem with the first values
13th Feb 2017, 10:58 PM
Mahmoud Sorour
Mahmoud Sorour - avatar