osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to compare lists


On Tue, Sep 1, 2015 at 3:08 PM, Jahn <jana1972 at centrum.cz> wrote:
> 1.
> How can I save 256 lists, each list has 32 values( hexadecimal numbers)
> 2.
> How to compare the saved lists with another 256 lists ( that are read online and have the
> same structure as the list one)?
> ( the first list must be saved in the  previous step)
>
> E.g

You seem to have missed out your example, but I'll guess at what
you're talking about. Correct me if I'm wrong, and we'll move on from
there.

You want to take a sequence of 32 numbers and see if it's exactly the
same sequence as some others. The easiest way to do this is with a
tuple, rather than a list; then you can simply do an equality check,
and they'll be checked recursively. If you want to ask, more simply,
"does this 32-value unit exist in my collection of 256 acceptable
32-value units", then a set will serve you well. You can stuff tuples
of integers into your set, and then query the set for a particular
tuple.

Does that help at all? If not, guide me to the problem you're actually
solving. :)

ChrisA