How to check that tuple A contains all elements of tuple B python?

The solution for “How to check that tuple A contains all elements of tuple B python?” can be found here. The following code will assist you in solving the problem.

>>> tuple1 = (1, 2)
>>> tuple2 = (1, 2, 3, 4, 5)
>>> set(tuple1).issubset(tuple2)
True
>>> set(tuple2).issuperset(tuple1)
True

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in