Don't rush be quiet I Need Help

this is my current code I get far, stop then get blown up.

def mod30(n):
    if n >= 30:
        return n - 30
    else:
        return n

# This function should return a value from 0 to 40 (0 <= n < 40)
def mod40(n):
    # Use an if-statement to return the correct value.
    if (0 <= n < 40):
        return n

# You don't need to change the following code:
while True:
    time = hero.time
    x = mod30(time) + 25
    y = mod40(time) + 10
    if y > 0:
        
        hero.moveXY(x, y)

1 Like

I’ll direct you to another post that is having the same issue.

1 Like

The only thing you need to fix up is the

if(0 <= n < 40):
    return n

This code should be similar to the mod30 function above it because it is supposed to do the same thing, just with 40 instead of 30. So, just change it so it is more like this:

 if n >= 40:
        return n - 30
    else:
        return n

Hope this helped!

Hi, I appreciate you helping Alzak Elvar, but could you not give the whole code away. That is all you have to write for the level so it is a solution. I suggest giving hints and helping them understand and letting them write the code.
You’re explanation was very good, maybe next time just leave out the actual code.
Thanks,
:lion: :lion: :lion:

1 Like

Okay, sorry about that, :sweat: I’ll do so next time. Thanks for the advice, @Deadpool198

It really is absolutely fine, thank you for helping.
:lion: :lion: :lion:

1 Like

actually I think this is what you meant, but I still get blown up.

1 Like
def mod30(n):
    if n >= 30:
        return n - 30
    else:
        return n

# This function should return a value from 0 to 40 (0 <= n < 40)
def mod40(n):
    # Use an if-statement to return the correct value.
    if (n >= 40):
        return n - 30
        pass
    else:
        return n

# You don't need to change the following code:
while True:
    time = hero.time
    x = mod30(time) + 25
    y = mod40(time) + 10
    if y > 0:
        
        hero.moveXY(x, y)
1 Like

There’s still a difference in the two mod() functions. (Hint: It’s not the pass)
:lion: :lion: :lion:

1 Like

what is the pass? I dont understand

1 Like

The word pass is simply a placeholder for if statements, functions or other type of code that need something to run, but you may not have the full code in place. This allows the programs that run the code to pass through it without getting stuck. The link below gives move details and some examples.

Understanding the pass statement

1 Like

Right, I thought in the very bottom of my code

1 Like

Is it the () ? (I could not spell it)

1 Like

or instead of doing - 30 do - 40 ?

1 Like

also, side note how do only cast chain-lightning if there are more than 5 enemies around?

1 Like

alright I solved it here is my code

Mod edit: Please don’t post final solutions.

1 Like