Practice Makes Perfect...stuck!


File "python", line 4
if number % 3 == 0:
IndentationError: expected an indented block

What am I doing wrong? Keep getting this error message!

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


Whitespace matters in python
Your if statement should be under by_three.

The traceback is pretty specific here in says you have an indentation error, says it expected indentation, and told you where.

This isn't to be mean, it's to encourage you to really learn about errors and to use them to your advantage. Don't be intimidated by them!


This section of the Python course has been giving me frustration unlike the others. Just stick with it :). I use to fly through other lessons, but now each part is a new challenge. Do what you can, and you'll make it through I feel. Progress seems slow for me, but progress is progress none-the-less!


Why is a zero needed on line 4? It is not asked for in the instructions so what is its purpose?


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