Ad
  • Custom User Avatar

    Adding to this: The second element in the tuple is used to solve the ties of the first element. Thus c.upper() renders every element a capital letter so sorted sees bBaAa as BBAAA. To solve the ties for BB and AAA we use c.islower() to get 01 and 010 sorted to 10 and 100 for the ties inside the same letters giving you BbAaa.

    You can of course stack more than two criteria in the tuple for additional tie brakers.

  • Custom User Avatar

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