Thanks to @papipupepappa for the project "Power Cat!" at https://scratch.mit.edu/projects/636328636, from which I have taken code for calculating exponents.