This isn't quite right. Obviously if there's a chance Monty might open the car, it screws up the gameshow, but it doesn't actually change the odds in the situation that he opened a door with a goat.
The knowledge in Monte's head doesn't change the odds.
To simulate this properly, you'll need to change the problem statement somewhat... you'll either have to throw out cases where he opened the door with the car, or state the problem such that we're only look at cases where he randomly opened a door with the goat. But you'll still get 2/3.
This python gist appears to simulate the situation correctly, and shows that it becomes 50/50.
https://gist.github.com/ecdavis/da8f67258860e9f35620
That said, I'm not sure I completely agree with this solution just throwing out cases where he opens the winning door, without replacement. I feel like at this point we're calculating a different problem where we haven't precisely defined what it is we're measuring, so you could tweak things to get either answer.
I advise students to always work this through from the combinations of possible scenarios.
The deeper truth of the vos Savant story is that verbal descriptions are ambiguous, and the even deeper truth is that probability calculations are highly volatile on information.
Eventually disagreements come down (among people who can competently do the calculations) to arguments about what such and such a phrase means, or what underlying probability distribution it implies.
Hence in the Monte Hall Problem, there is no advantage to switching if Monte selects the unchosen door to open at random, and it happens to be a goat. That situation is consistent with the description, but perhaps not the 'feel' of the game show setup.
In science, it is wise to be aware of this. If you have probability calculations that are so volatile based on interpretation, then you probably want to avoid trusting the results, no matter how careful your hermeneutic.