Problem: How to clear all remnants of random.py, random.pyc, and random.pyo that isn't part of Python's standard library?
use mdfind to locate all the files with that name (you might need to grep -w for the string or use mdfind with a "kMDItemFSName == whatever.py" clause)

Once you know where you've sprayed those files, you could either edit it into the question or decide to do a clean install / migrate user data or remove all the python and then patch that together from a clean install on an external drive.

It's had to know what specific things you've done, but hopefully a few of the tools can narrow you down to some options.

If I were on deadline and just needed to know what version of python was running - I'd brew install python after setting up https://brew.sh

You'd then have three installations, but the one that runs from the shell is controllable with $PATH and you can be sure it's up to date with homebrew.