Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)
I'm new to python and I am perusing an online book. There is a chapter that clarifies the contentions of what they are and when they are utilized however I don't comprehend the explanations that well. Would anyone be able to clarify better what arguments are? What's more, if it's not too much trouble, attempt to clarify as straightforward as possible since I am a beginner and English isn't my local language.

1 Answer

0 votes
by (26.4k points)

An argument is just a worth given 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 generally appear differently in relation to parameters, which are names used to determine what arguments a function will require when it is called. At the point when a function is called, every parameter is doled out one of the argument values. 

# foo has two named parameters, x and y

def foo ( x, y ):

    return x + y

z = foo( 3, 6 )

The foo is given two arguments, 3 and 6. The main argument is appointed to the primary parameter, x. The subsequent argument is relegated to the subsequent parameter, y.

Are you pretty much interested to learn python in detail? Come and join the python training course to gain more knowledge.

Related questions

Browse Categories

...