Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
19,429 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.