What is the difference between a parameter and an argument?

This isn’t a question, I just noticed something in this lesson. In the first part of example code to explain setting up a parameter in a function and then creating an argument:

def greet_customer(special_item):
    print("Welcome to Engrossing Grocers.")
    print("Our special is " + special_item + ".")
    print("Have fun shopping!")

but in the example where it says what would be printed when (w/ peanut butter as an argument), it shows Grocers as Grocer’s. See:

Welcome to Engrossing Grocer’s.
Our special is peanut butter.
Have fun shopping!

To be precise (and consistent with the thread title): special_item is a parameter (a placeholder that tells you the name of a variable to be found within the function body), and “peanut butter” is an argument ( a value that is assigned to the parameter variable when the function is called.)

  • parameter = variable name
  • argument = value

Thanks for pointing that out!

1 Like