I am new to coding and this is for a class. I'm really stuck, any help would be much appreciated!!
Hi @GreenCheek and welcome to the forum,
I wrote this script for you that should do the trick. It's a lot cleaner than the one generated by Blockly:
As for Blockly, I don't really know how to get it done - and also don't know if it's possible.
But definitely let know if the Gist works for you and if you have any other questions!