how to make this situation return this result?

justin walters walters.justin01 at gmail.com
Sat Jul 1 11:33:22 EDT 2017


On Sat, Jul 1, 2017 at 5:45 AM, Ho Yeung Lee <jobmattcon at gmail.com> wrote:
> just want to compare tuples like index (0,1), (0,2), (1,2) without
> duplicate
> such as (2,0), (1,0) etc
>>
I'm going to assume that the order of values in the tuple is important to
you.
If so, you can simply use the `==` operator to compare them.
For instance:
```
 a = (0, 1)
 b = (0, 1)
 a == b
 >>> True
 a = (1, 0)
 b = (0, 1)
 a == b
 >>> False
```
Using the `is` operator will return `False` as a and b are completely
independent objects.
```
 a = (0, 1)
 b = (0, 1)
 a is b
 >>> False
```


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /