Someone (or multiply people) wrote a function called sort, which allowed you to sort things based on number/strings on alphabetic order. If you want a better understanding of sort, you can write your own, the easiest two are merge and bubble sort if i am not mistaken, i am sure you can find tutorials for them online

Actually sorting in Python can sort by basically any criterion you can think of, like length of the elements or stuff like that; just set the key parameter and you are done

Your fantasy is the limit: you can set the key parameter to whatever you like (normally as a lambda).

For example, if pippi is a list of strings:

sorted(pippi, key=lambda a: -ord(a[0])*len(a))

would sort it taking the first char in reverse alphabetical order and multiplying its value by the length of the string itself.

On a side note, the current sorting algo is a hybrid (for efficiency), using mostly the merge sort (usally the best option for large arrays/lists), IIRC.

And, uh, let’s say I have built a reputation elsewhere for juggling with an insane number of instructions into my (un)famous one-liners solutions

Like this:

function_for_a_kata_will_not_name=lambda c: lambda p,t: (lambda i,n: 'Invalid present value' if p<0 else 'Invalid duration' if t%1!=0 else 'Invalid rate frequency' if n==None else 'Invalid interest rate' if i==None else round(p*((1+i/n)**(n*(t-(t%(1/n) if n<1 else 0)))-1),2))(float(c["rate"][:-1])/100 if (lambda r: len(r)>1 and r[-1]=="%" and r.count(".")<=1 and all(x in "0123456789" for x in r.replace(".","").replace("%","")))(c["rate"]) else None,{"daily":365, "weekly":52, "monthly":12, "quarterly":4, "annually":1, "biennially":0.5}[c["frequency"]] if c["frequency"] in ['daily', 'weekly', 'monthly', 'quarterly', 'annually', 'biennially'] else None)

Believe it or not, this stuff is a single line that works to solve a given problem and is EXCELLENT practice to improve your skills

So, is this complicated enough for you ? I hope so