DEV Community

HHMathewChan
HHMathewChan

Posted on • Originally published at rebirthwithcode.tech

Python Concept Learning Point 2: What is the difference between arguments and parameters?

  • Parameters are the names appear in the function definition.
  • Arguments are the value that actually pass to a function.
  • Parameter control what value(parameter) should pass to a function.
def calcaulate_book_cost (number_of_books):
    return number_of_books * 3

print(calcaulate_book_cost(4))
Enter fullscreen mode Exit fullscreen mode

In the above example, number_of_books is the parameter, since it appears in the definition of the function.
4 is the argument, since it appear in the function calling and it is the value actually pass to the function to process.

Credit

Python doc (Accessed at 2022 JUN 09)

Top comments (0)