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 Functions, Packing, and Unpacking Introduction to Functions Create and Call a Function

Difference in print("pass") and plain: pass

I wrote and expected this a solution:

def my_first_function():

   print("pass")

but the corrector says the answer I gave was wrong. I think the question may not be interpreted in the wrong direction for I assumed the question with the word: "pass" means use the print function line and put "pass" in parentheses.

Also I hope I am not misunderstanding this, I did not see the speaker give examples including functions example below but she did in the instance above:

def my_first_function():

   pass

If you notice in the next set of questions, there is the same lines of codes without the print("pass"). I am willing to be absolutely wrong for I am newbie to computer coding have no experience what so ever. I am eager to learn.

Thanks Team Treehouse for offering high-quality tutorials and coding experience.

creating_functions.py
def my_first_function():
    pass

1 Answer

Josh Keenan
Josh Keenan
20,315 Points

So they are two different things, one is outputting the string "pass"

print("pass")

The other is essentially saying the function doesn't do anything, pass control to the next process that needs to be executed. Hope this makes sense, feel free to ask any further questions.