My approach uses a remote interface called RCON to send Minecraft operator commands to the world. It can do everything you could do with Command Blocks or Operator commands and more because of the Python constructs like loops and branching.
The other benefit is that you get to use the latest developer tools such as VSCode and the latest version of Python as you are working outside of the Minecraft game to write your code.