Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics Functions and Looping Create a Function

Inconsistant use of space in.....WHAT?!

Inconsistent use of tabs and spaces in indentation?

I don't get this error message. This formatting works on my RPi and it comes out with a result. but I don't exactly understand why it is not acceptable here in the treehouse.

by the way, the end result is: 259081

def square(number):
    result =number*number 
    print (result)

1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! Something has happened when copy/pasting over. This is not so much a problem with the challenge as it is something specific to Python. Python is highly sensitive to whitespace. It uses indentation to determine where a code block starts and ends. Because of this, you may not have a mix of indentation methods inside the same python file. You may not indent one line using spaces and then indent the next line with a tab. This is when this error occurs. You will need to erase the indentations here and make sure you use the same method on each line.

Once you fix that, there will still be a problem The challenge asks you to return the result, but you are printing the result. Also, you do not need to call the function yourself. Treehouse will do that for you and send in a number of its choosing.

Hope this helps! :sparkles: