0
Someone pls elaborate: cmp() method of list in python. With an example. And how cmp() compares lists and returns outputs.
3 ответов
+ 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
+ 2
...Ah list perform
(a>b)-(a<b)
to compare the list
that's it....
0
I don't really know how cmp compares lists in python.....explain pls.....@Very_Hard(asm & js & c++ & java & py & (@Hard))