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

Tony Brackins
Tony Brackins
28,766 Points

I'm having an issue following along with Python

When i try to do anything that they do in the Python work space, I believe there is a spacing issue which is making it terribly hard for me to follow along.

I can't recreate anything that the teacher is creating and get it to work.

2 Answers

Tommy Gebru
Tommy Gebru
30,164 Points

Hey Tony, When writing code with Python whitespace can affect code /syntax if it is structured in a different manner. i.e.

def spam():
eggs = 12
return eggs

print spam()

as opposed to

def spam():
    eggs = 12
    return eggs

print spam()
David Bouchare
David Bouchare
9,224 Points

On that note, the below says it is better to use 4 whitespaces than tabs:

http://legacy.python.org/dev/peps/pep-0008/#code-lay-out

What do you all think?