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

Darren Taylor
Darren Taylor
1,052 Points

Fully Functional.... I can't get the functions to work in Workspace, can you please help.

This is the function that I printed:

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

hows_the_parrot()

In the shell this is the outcome:

treehouse:~/workspace$ python
Python 3.5.0 (default, Jul 13 2017, 17:35:34)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.

exit()
treehouse:~/workspace$ python functions.py
treehouse:~/workspace$

But I want it to read: "He's pining for the fjords!"

7 Answers

I had the same thing happen to me. I just to a shot in the dark and saved the file then it worked for me.

Hey Darren!

Try using the markdown cheatsheet to format your questions appropriately in the forums. You can use triple to start a section of code, followed by the language you are using, and closing it with another triple. The markdown cheatsheet is right under the answer text field. Anyway, I'll try to help as best as I can. This code should work for your function:

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

hows_the_parrot()

Pay attention to the indentation of your code, you should always indent the code block of your functions with 4 spaces. Let me know if you need any more clarification.

Darren Taylor
Darren Taylor
1,052 Points

Thanks a lot for your help Eric.

chino vivar
chino vivar
387 Points

Mines still not working and I copied and paste your answer.

Can you post your code chino?

Australia Kimbrough
Australia Kimbrough
781 Points

I'm having the same issue as Chino Vivar. My code is:

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

hows_the_parrot()

It looks exactly like the example you provided above. The error code I keep receiving is:

File "<stdin>", line 1 python functions.py SyntaxError: invalid Syntax

I'm receiving an error code for both examples in the Fully Functional video.

Hey!

You need to post your code using the triple `... So I can check indentation and other stuff Check the Markdown Cheatsheet just below the text field for comments on this page.

Daniel Ducas-Viramontes
Daniel Ducas-Viramontes
2,879 Points

Hi guys before you execute your file make sure your out of the python shell if you see >>> then your still in the python shell get out by using exit() then after execute your file functions.py in the console Not in the python Shell. like this: treehouse:~/workspace$ python functions.py

Yeah this isn't working... I even changed functions.py to just print("hello world"), but when I call the functions.py in workspace I get nothing back. I feel like something isn't working here. Will update when I figure it out...