Stuck on Practice makes perfect


#1



please help me with this!



Oops, try again. Your code looks a bit off. Check the console window for errors!


Replace this line with your code.


#2

The url is just so we can access the exercise and debug your code in the exercise, but the url will load our own exercise code. So please also include your code in this forum topic, as this line:

Replace this line with your code.

in your template suggest


#3

ok :stuck_out_tongue: haven't got the hang of it yet : D


#4

just select all the code in the exercise, right click -> copy (or ctrl + c if you like keyboard shortcuts), then make a reply in this topic and right click -> paste (or ctrl + v if you like the keyboard)


#5

oh, fell such an idiot, found out what I was doing wrong :unamused: missing colons.


#6

programming is difficult, a mistake is easily made


#7

oh, was like this

def cube(number):
return number**3
def by_three(number)
if (number % 3 == 0)
return cube(number)
else:
return False


#8

should be this

def cube(number):
return number**3
def by_three(number):
if (number % 3 == 0):
return cube(number)
else:
return False


#9

stupid mistake indeed, it can happen, but finding it yourself is better :slight_smile: So good job :slight_smile:

also, if you want indention to show on the forum, you need to use markup:

the template which is provided to you when creating the topic includes the backticks:

 ```python
 replace this line with your code
 ```

Your topics/questions are already getting better :slight_smile:


#11

I am getting an indentation error and I cannot find it

def cube(number):
        return number**3
def by_three(number):
        return number * 3
    if number % 3 == 0:
        return cube(number)
    else:
        return False

#12

Looks like line 2 "return number**3" is double indented and needs to be backspaced once to be in line with if and else


#13

here:

def by_three(number):
        return number * 3

why the return number *3 in the the by_three function? i don't see the instructions tell you to do this


#14

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.