Okay, so today I messed around with this “under and over” thing, and let me tell you, it was a bit of a rollercoaster. I’d heard about this concept before, you know, dealing with values that are either below or above a certain threshold. Sounds simple enough, right? Well, not so fast.

First, I grabbed some data I had lying around. Just a bunch of numbers, nothing fancy. I figured I’d start easy and just try to split them into two groups: those under 100 and those over 100. Easy peasy, I thought.
So, I wrote a little script. It was pretty basic, just going through the numbers one by one and checking if they were less than 100 or not. If they were, I chucked them into one bucket. If not, into another.
- Check if the number is under 100.
- If yes, put it in the “under” bucket.
- If no, put it in the “over” bucket.
I ran the script, and boom, it worked! I had two nice piles of numbers, all neatly separated. I was feeling pretty good about myself at this point.
But then, I got to thinking. What if I wanted to be a bit more flexible? What if I wanted to change that threshold from 100 to something else? Or what if I wanted to use multiple thresholds? Things started to get interesting.
I spent a good chunk of the afternoon tweaking my script. I added some options to let me set the threshold to whatever I wanted. Then, I went even further and made it so I could use a bunch of different thresholds at once. Now we’re talking!

More Than Two Buckets
This opened up a whole new can of worms. Now, instead of just two buckets, I could have as many as I wanted. I ended up with numbers sorted into all sorts of categories, like “under 50”, “between 50 and 100”, “between 100 and 150”, and so on.
It took some doing, but I finally got it all working the way I wanted. It was definitely more complicated than I initially expected, but hey, that’s how it goes sometimes. You start with something simple, and before you know it, you’re knee-deep in a whole new challenge. At least I’ve got a solid script out of the deal, and a fun afternoon filled with head-scratching moments!
I’m sure there are better ways to do all this, but for a quick and dirty solution, I think it works pretty well. Anyway, that’s my little adventure with “under and over” for today. Maybe I’ll tackle something even more crazy tomorrow. Who knows?