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 (2015) Logic in Python Fully Functional

My script doesn't seem to run despite it being indented properly. I am getting an error in the shell!

Hi there,

I've written a function and saved it as functions.py.

The code looks like this:

def hows_the_parrot(): print("he's pining for the fjords!")

hows_the_parrot()

However when I try and run this in the shell 2 things happen:

  1. when I hit "tab" it doesn't add the ".py" to the file I type
  2. I get this error: python functions.py File "<stdin>", line 1 python functions.py ^ syntax error: invalid syntax.

Please help! My workspace is here: https://teamtreehouse.com/workspaces/35381062#

1 Answer

You may want to put "print(" whatever ") in a new line under the function definition, and indented

def a():
   print("b")