python - comparing lists with lists -
possible duplicate:
may know how can compare lists
ok m making game poker card evaluator , storing values in list of list , each list containing values [rate,rank,max] or [1,2,3] question if want know players has hand mean list example comapring list list, if rate1==rate2(list2 in list of lists) have check rank same if condition true have go next value in same list , check other list having same first 2 values. if both lists equal equal else find greater one(rate,rank or max)
and infinite list dont know length of list , charcters
list1 == list2
return true
, if every element in list1
equals corresponding element in list2
.
for example:
>>> = [1, 2, 3] >>> b = [1, 2, 3] >>> == b true >>> = [1, 4, 3] >>> b = [1, 2, 3] >>> == b false
list1 > list2
return true
if, in first pair of unequal corresponding elements, element in list1
greater element in list2
. true whether or not, in subsequent pairs of unequal corresponding elements, element in list2 greater element in list1.
>>> = [2, 2, 3] >>> b = [1, 3, 3] >>> > b true
Comments
Post a Comment