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

def hows_the_parrot(): doesnt print the .py

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

hows_the_parrot()

I saved it as func.py. I try to run it on the console as "python func.py" and it spits out "invalid syntax"

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

Intend

1 Answer

Hey spiderman,

First, Bapi's response will correct your syntax. In your file, you've only defined the function and haven't called it. When you type "python func.py" into the console, it won't do anything because the file only contains a definition of a function. In order to see the print value, you'll either need to call the function within the file, or, within your Python shell, import func then call the functional manually using func.hows_the_parrot().

Either:

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

hows_the_parrot()

Or:

>>> import func
>>> func.hows_the_parrot()

Hope this helps, and let me know how it goes!