Ad
  • Custom User Avatar

    The function name is to_float.. So I decided to return only floats.
    But according to the description you are right.
    And if there are ints and floats the code with "if '.' in num" is great.

    Best practices +=1 from me.

  • Custom User Avatar

    Readable and ideomatic.
    Not performant for large arrays. But that was not required in the description.
    So "best practice" from me

  • Custom User Avatar

    Great. Performs for big arrays. And readybility is good too, whenever I prefer a variable like 'offset' for 'i+1'.

  • Custom User Avatar

    Contrary to other comments, I like this soluluton. Of course it doesn't perform on large arrays. But there is no "large array warning" in the description. And the code is clear, readable and ideomatic. So for me the high score on 'best practices' is deserved.

  • Custom User Avatar

    I struggled with the same problem with the spaces and like your workaround. Clever.

    The more common and probably better solution is to use split(' ') instead of split().
    Takes care of the spaces and works even if the word distances are not consistent.

  • Custom User Avatar

    Algorithm is efficient because it stops early. Code is good to read despite the extra lines for the early stop. I like it.