6. Practice Makes Perfect Help


#1



https://www.codecademy.com/courses/python-beginner-c7VZg/1/5?curriculum_id=4f89dab3d788890003000096#

Indentation Error, expected indented block.


Well I don't know why it's weirded out by my indentations... but to be honest I'm more worried if have the "by_three(cube[number])" part right and whether or not I've put it in the logical spot.


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


#3

Ok so instead of doing these two lines above you should just return the cube(number). Also, at least for me I had my syntax set up a different way:

def cube(number):
    return whatever
def whatever:
    if whatever:
        return whatever
    else:
        return whatever

#4

I've been working on this one for hours!!! And it's the first time I ever used a forum. OMG this is the best!!! Thanks for helping me!!!!


#5

Haha no problem man! I know I hate being stuck on stuff for long periods of time so I am glad to help another! Hopefully your other lessons go smoother and if you have any questions you know where to go :sunglasses: happy coding! :smiley:


#6

Thanks man! Was stuck on that section for a while.


#7

here raw_input(number) takes number as a string in python 2 so, use int(raw_input)


#8

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