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

Anzor Gurashvili
Anzor Gurashvili
890 Points

I can't get text printed out like in the video

I can't get text name printed out like it shows in the video. I type in functions.py i get blank. My function looks like this :

def how_the_bunny():
  print ("He's fluffy") 

how_the_bunny()

20 Answers

slavster
slavster
1,551 Points

Had this same issue. Kenneth doesn't explicitly call this out in the video but you need to save functions.py first. Ran like a charm for me after that.

Your code seems to work in my IDLE (Integrated DevelopMent Environment).

Are you sure you are entering the right command in the Console?

You should type this into the Console

python functions.py

I hope this helps. ~Alex

teki
PLUS
teki
Courses Plus Student 877 Points

In the console, have you exited python first before running the script? So first, exit() and then python functions.py

I just made that mistake, not sure if it's the same problem :/

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,454 Points

The issue is you have to use parens to call the function:

def how_the_bunny():
    print("Fluffy bunny")
how_the_bunny()   #  <-- add parens

The code originally posted has the parens, but doesn't match the workspaces snapshot you've shared.

Anzor Gurashvili
Anzor Gurashvili
890 Points

i do type command into the console , I don't get output to print out like it shows in the video.

Tagging Kara P & Kenneth Love

teki
PLUS
teki
Courses Plus Student 877 Points

Your code works on my screen as well, so not sure what's wrong. Is the file spelled correctly to match functions.py?

Anzor Gurashvili
Anzor Gurashvili
890 Points

yes and ive also used tab to auto-fill it

Type pwd into the Console. Make sure you typed exit() if you are still in the Python Shell!

What do you see?

Anzor Gurashvili
Anzor Gurashvili
890 Points

I've been typing exit() function in python shell from the start. When I enter python functions.py shell gives me same entry as if I just pressed enter on empty space.

Dude type pwd in the Console.

Anzor Gurashvili
Anzor Gurashvili
890 Points

bash: syntax error near unexpected token `pwd' . Now what ?

Um, it shouldn't cause a Syntax error...

I'm sure sure why your workspace isn't running, but if I were in your situation, I would download your project files so that you got the project stuff all safe, then delete the workspace & create a new one while uploading the files your've downloaded.

If this doesn't work, I'll tag Kenneth Love and/or Chris Freeman.

Zack Thompson
Zack Thompson
356 Points

im having the same problem as anzor

Anzor Gurashvili
Anzor Gurashvili
890 Points

Still doesn't work. I feel like I'm wasting my time and money on teamtreehouse. What's the point if they can't get you being to run simplest form of code.

Yeah, pwd is supposed to be a valid command... Dunno what's wrong... Tagging Kenneth Love and Chris Freeman

Remember; you can never send a link directly to your workspace. The only person who can click onto that link and go to your workspace is yourself. For everybody else it won't work, including myself.

Make a snapshot of your workspace and send that link :)

Yep it does :)

I'm going to check on it now. I'll reply when I found the error.

Ah I see. You are missing the () parens when you are calling the function :grin:

Remember: Always put the parentheses when calling the function, even if it takes no arguments!

I hope this helps :)

(Lol I posted this less than 1 minute after the first reply. I found it so quickly :laughing:)

Anzor Gurashvili
Anzor Gurashvili
890 Points

ok , other hundred times i wrote this function , I've included parenthesis at the end. It still doesn't work.

Your code works... I checked your workspace...

Anzor Gurashvili
Anzor Gurashvili
890 Points

ok its working, i think its because i wasn't saving file........

Awesome! Can you give somebody other than yourself a Best Answer? Thanks! :sparkles:

Chris Freeman
Chris Freeman
Treehouse Moderator 68,454 Points

I recommend Stanislav Sinitsyn for the Win since they first suggested the "save file" solution.

Lol 18 answers...

abdellatif zouliga
abdellatif zouliga
1,978 Points

i didn't get the output in the console after trying many times, that is why i used pycharm

Code in the video does not run in workspaces...?