goalie.are_set_equal

goalie.are_set_equal(x: Iterable[Hashable], y: Iterable[Hashable]) bool

Check whether x and y contain the same elements, ignoring order.

Parameters:
  • x (iterable of hashable) – First collection to compare.

  • y (iterable of hashable) – Second collection to compare.

Returns:

True if x and y have the same set of elements.

Return type:

bool

Examples

>>> are_set_equal(["a", "b"], ["b", "a"])
True
>>> are_set_equal(["a", "b"], ["b", "c"])
False
>>> are_set_equal([1, 2, 2], [2, 1])
True