It's not crappy code if it works, right? Right?
Just a quick note, here. There is no sanity checking whatsoever on input, so this is most definitely not bulletproof code. For those challenges that require arguments, just pass the -h flag, and it will give you hints as to what you will need.
Were this actual code, I'd break it down further into functions and maybe a module to import, but I'm just not that bright, and I'm just looking to make things work.
Thanks for your time and attention.