What are "arguments" in python
arguments, python
Solution
An argument is simply a value provided to a function when you call it:
x = foo( 3 ) # 3 is the argument for foo
y = bar( 4, "str" ) # 4 and "str" are the two arguments for bar
Arguments are usually contrasted with parameters, which are names used to specify what arguments a function will need when it is called. When a function is called, each parameter is assigned one of the argument values.
# foo has two named parameters, x and y
def foo ( x, y ):
return x + y
z = foo( 3, 6 )
`foo` is given two arguments, 3 and 6. The first argument is assigned to the first parameter, `x`. The second argument is assigned to the second parameter, `y`.
Problem
I am new to python and I am reading an online book. There is a chapter which explains the arguments of what they are and when they are used but I don't understand the explanations that well. Can anyone explain better what arguments are? And please try to explain as simple as you can, because I am a beginner and English is not my native language