Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

squaring.py
def square(number):
    result =number*number 
    print (result)
square(509)

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
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: