Ad
  • Custom User Avatar

    No .format() solution because im way to lazy to understand how that works.
    Still, this works

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    I made a whole function to separate the number from each word and added it to the same list to make a 2d table, afther that i used list comprehension to sort the words and at the same time eliminate the number, all of this last part inside a " ".join(...) to transform the array again into a string.

    The problem is that I realized way to late that by sorting again each word the number is separated and put in the first position of the array (so word[0]) so the whole function to separate the number is unnecesary. Plus this can be done inside the sorted() by using "key = lambda x:sorted(x)" efectivly sorting two times in a row and automatically sorting each word into place.

    Even though big part of my code is unnecessary im proud i could solve this problem by myself and without the use of external libraries.

  • Custom User Avatar

    I just realized you dont need to turn it into an array becuase you can use sorted() on strings so just do sorted(srt(num),reverse=True
    Also there is no need to create a variable to return and can just write the "".join(...) directly into the return