Returns the unique symmetric difference between two arrays, not containing duplicate values from either array.

Use Array.prototype.filter() and Array.prototype.includes() on each array to remove values contained in the other, then create a Set from the results, removing duplicate values.

继续阅读 30秒学会 JavaScript 片段 – uniqueSymmetricDifference

Returns the n maximum elements from the provided list.
If n is greater than or equal to the provided list’s length, then return the original list (sorted in descending order).

Use sorted() to sort the list, [:n] to get the specified number of elements.
Omit the second argument, n, to get a one-element list.

继续阅读 30秒学会 Python 片段 – max_n