0

Someone pls elaborate: cmp() method of list in python. With an example. And how cmp() compares lists and returns outputs.

20th Jan 2018, 11:57 AM
Tincture
3 Respostas
+ 4
absolutely cmp was removed in python and can do like this instead (a>b)-(a<b) (a is list1 and b is list2) Also That is how cmp function perform/return value like a=[1,2,3] b=[1,2,3] #print(cmp(a,b)) print((a>b)-(a<b)) if you don't understand/know how list compared in python you can ask
20th Jan 2018, 12:49 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 2
...Ah list perform (a>b)-(a<b) to compare the list that's it....
23rd Jan 2018, 9:26 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
0
I don't really know how cmp compares lists in python.....explain pls.....@Very_Hard(asm & js & c++ & java & py & (@Hard))
23rd Jan 2018, 5:23 AM
Tincture