Set Cardinality

In this exercise we will implement a set cardinality operator.

Name the operator Cardinality. It should accept a set and equal the number of elements in that set.

Examples

  • Cardinality({1, 2, 3}) = 3
  • Cardinality({"a", "b"}) = 2
  • Cardinality({}) = 0
set-cardinality
Ready
⌘↵ to submit