Ad
  • Custom User Avatar

    I tried making a language-agnostic description. It would only need to add a comment in solution setup to precise the type of greek_alphabet. It shouldn't be too difficult as there is currently one approved language.

    Description Write a comparator for a list of phonetic words for the letters of the greek alphabet.

    A comparator is:

    a custom comparison function of two arguments (iterable elements) which should return a negative, zero or positive number depending on whether the first argument is considered smaller than, equal to, or larger than the second argument

    (source: https://docs.python.org/2/library/functions.html#sorted)

    The greek alphabet is preloaded for you as greek_alphabet. Its type (e.g., tuple, list, table, etc.) depends on your language and is specified in a comment within the solution setup:

    greek_alphabet = [
      "alpha", "beta", "gamma", "delta", "epsilon", "zeta",
      "eta", "theta", "iota", "kappa", "lambda", "mu",
      "nu", "xi", "omicron", "pi", "rho", "sigma",
      "tau", "upsilon", "phi", "chi", "psi", "omega"
    ]
    

    Examples

    Inputs: "alpha", "beta"
    Ouput: a negative number
    
    Inputs: "psi", "psi"
    Ouput: 0
    
    Inputs: "upsilon", "rho"
    Output: a positive number
    

    code to copy/paste Write a comparator for a list of phonetic words for the letters of the [greek alphabet](https://en.wikipedia.org/wiki/Greek_alphabet).

    A comparator is:
    > *a custom comparison function of two arguments (iterable elements) which should return a negative, zero or positive number depending on whether the first argument is considered smaller than, equal to, or larger than the second argument*

    *(source: https://docs.python.org/2/library/functions.html#sorted)*

    The greek alphabet is preloaded for you as `greek_alphabet`. Its type (e.g., tuple, list, table, etc.) depends on your language and is specified in a comment within the solution setup:

    ```
    greek_alphabet = [
      "alpha", "beta", "gamma", "delta", "epsilon", "zeta",
      "eta", "theta", "iota", "kappa", "lambda", "mu",
      "nu", "xi", "omicron", "pi", "rho", "sigma",
      "tau", "upsilon", "phi", "chi", "psi", "omega"
    ]
    ```

    ## Examples

    ```
    Inputs: "alpha", "beta"
    Ouput: a negative number

    Inputs: "psi", "psi"
    Ouput: 0

    Inputs: "upsilon", "rho"
    Output: a positive number
    ```

  • Custom User Avatar
  • Custom User Avatar

    iterable elements

    this is missing context which is in the original source text but is not applicable here. it should be removed.

  • Custom User Avatar

    Duplicate.

  • Custom User Avatar

    Needs random tests.

  • Custom User Avatar

    The kata setup really needs to be rewritten. For starters, everything in user code should be wrapped in a class. Currently variables are operated in global scope ;-(

  • Custom User Avatar
    • the contract in the description doesn't match the implementation
    • the normalisation should be done in the test side, not the user side.
  • Custom User Avatar

    This test makes no sense:

    my_leafer([Node(0)]) # expects (Node(0), []))
    

    If the node has no child then it's a leave, even if it's a root node.