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,311 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.