Rosa’s report now thanks Ben Carter and Gus Tanaka for their help, and the committee has follow-up questions. Did all three committee members help? Did anyone attend both work days? Who attended only one day? Was this spring’s crowd the same as last year’s?
Python answers each with an operator or a method. JavaScript has methods for the first three, but no operator or method for the last.
Ask About Subsets and Overlaps
Python’s <=, >=, and .isdisjoint(), plus ^, each have a camelCase method on Set. Each one takes another Set or anything with size, has(), and keys(), such as a Map. As with .union(), passing an array throws a TypeError, even though Python’s .isdisjoint() takes any iterable, so wrap it in new Set() first. The first three methods return true or false, and .symmetricDifference() returns a new Set, as .union() does:
| Python | JavaScript |
|---|---|
a <= b |
a.isSubsetOf(b) |
a >= b |
a.isSupersetOf(b) |
a.isdisjoint(b) |
a.isDisjointFrom(b) |
a ^ b |
a.symmetricDifference(b) |
Here are the committee’s first questions, with helped built from the two work days as before: