Don't Rush Be Quiet (Level Help)

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


def mod40(n):
    # Use an if-statement to return the correct value.
    if (n >= 40):
        n = n - 40
        return n

while True:
    time = hero.time
    x = mod30(time) + 25
    y = mod40(time) + 10
    hero.moveXY(x, y)

Every time I start my code it saysAnnotation 2020-08-08 170711
Thanks, @Jake_Doggy

It should be if n>= 40, return n - 40. Then put

inside an else statement.
Hope it helps!
Lydia

1 Like

this is the full screen

staff can you look at this problem?

[en_US.composer.my_buttons_text]

What’s the point of adding bracket around n >= 40 because putting brackets is only for JavaScript.

Do the same thing you did for mod30(n) but change the 30 to 40. Hope it helps this time.
Lydia

While not required in PY, it can help group statements…it is typically used for clarity and ease of reading. Otherwise, since multiplication and division is performed before addition and subtraction, brackets can be used to circumvent this rule. Example:

5 * 2 + 1 = 11
5 * (2 + 1) = 15

2 Likes

Oh yeah sorry I forgot about that didn’t thought about it.

2 Likes

Can you give me the link to the level :wink:?
-Rachel

1 Like

https://codecombat.com/play/level/dont-rush-be-quiet?

Ok, thanks :heart: I’ll check it out now.

You wrote

def mod40(n):
    # Use an if-statement to return the correct value.
    if (n >= 40):
        n = n - 40
        return n

However, all you need to do for that is to copy the

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

and change the value(to 40)
-Rachel

1 Like

Yeah, that was what I was telling @Jake_Doggy to do.
Lydia

1 Like

Does this work for you?

yay I won! 200000000000000000000

1 Like

Congrats on solving the level! :partying_face:
Lydia

1 Like

thanks 2000000000000000

1 Like

You’re welcome. :smile: :smile: :smile: :smile:
Lydia

I’m currently helping someone solve a level maybe you can help?

1 Like

Yes, of course, invite me to the topic!
Lydia