Implement C's Switch in Python 3
The discussion strictly sets a limit of 31 for the largest number of days in
a month and asks for suffixes used to make ordinal numbers like 31st.
But in reality, you can go to 99th and beyond for other purposes albeit the
pattern for making 101 and on seems to repeat.
The last algorithm I wrote would work up to 99 in terms of the function I
wrote. To make it work higher, you would simply start by taking the original
number mod 100 before continuing and then use the original number at the
But if the goal is to make a list or dictionary out of it, it gets a tad
large for the 8423rd and not manageable too far above.
If you will be using whatever technique just once, precomputing a list or
dict is extra effort. For MANY uses in the same program, it makes sense to
make a more static data structure with rapid access.
So what if you only compile lower numbers into the structure but call the
function version for higher ones?