Python Concept Learning Point 2: What is the difference between arguments and parameters?
HHMathewChan
Posted on June 9, 2022
- 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))
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)
💖 💪 🙅 🚩
HHMathewChan
Posted on June 9, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
githubcopilot AI Innovations at Microsoft Ignite 2024 What You Need to Know (Part 2)
November 29, 2024