Practice Makes Perfect...stuck!


#1


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)
else:
    return false


#2

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!


#3

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!


#4

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


#5

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