Issues trying to eliminate global variables in Blockly

 I am trying to get my Blockly code to run without global variables. How would I change it in blocks to get the resulting Python and JavaScript codes to run without using globals? The code I currently have will generate the desired output, but only one line at a time, and you have to keep hitting enter to get each line of output. How can I fix that as well, and just get all of the output at once?

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!