Ad
  • Custom User Avatar

    Oh neat!

    We learned new stuff.

    First and foremost "return n if n < 10" is the base case.

    The map function applies a given function (in this case "int") to every item of something that is iterable. -> new for me!

    Using the string function on the input n, you turn n into a string which is iterable. Therefore the map functiion can now apply a given function to each character of a string. -> the clever part!

    Once the map function is done applying int to every digit, it is then all summed together.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I do enjoy seeing the one liners. It lets me learn more about how flexible Python can be.