I need help on sarven desert

I cant solve Cubic Minefeld. I dont know what i did wrong. Please
help.
Shared with CloudApp

Hi,

You want a function that is very similar to the one that’s above.

If we use the mult function, and try to find mult(4,5), then this calculates 4+4+4+4+4, which outputs 20.

We are trying to write the power function, so if we try to find power(4,5) then we want it to calculate 4x4x4x4x4 (which incidentally will output 1024).

The power function will be really similar to the mult function - what is the small change that you need to make?

Post again if you need more help.

Jenny

1 Like

Well, thank you for helping, but I couldnt quite understand what you mean.

Ah OK. Do you know about powers? Ie what “two to the power of three” means?

Jenny

To make things simple, you know what the ×(Multiplication) symbol does right? It’s basically adding the same number n amount of times. ie 5 × 7 can be expanded into:
5 + 5 + 5 + 5 + 5 + 5 + 5 = 35.

Now imagine powers as something like multiplication, except the + symbol is now ×. Hence 5 to the power of 7 would be something like:
5 × 5 × 5 × 5 × 5 × 5 × 5 = 78125.

In the function power, it’s taking in two arguments, number and exponent. So if you were to write the function in pseudocode, it will be something like this:

  1. In variable total, for exponent amount of times, number will be multiplied by number.
  2. Return total.

If you wrote the function correctly, hero.say(power(7,4)) will make the hero. say 2401.