DEV Community

HHMathewChan
HHMathewChan

Posted on • Originally published at rebirthwithcode.tech

4 3

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more