0
What is parameter in python, what is attribute ?
Can you explain
2 ответов
+ 3
As this question is asked very often, you can find further information by using the search bar of q&a in sololearn app. You can also use search bar in learn section to find documents and tutorials.
+ 1
in every programming language, parameters are those variables that we create inside () when we create a function, it serves to receive values from outside, which are called arguments
example:
def Sum (x, y):
return x + y;
Sum (3.5)
This will return 8, where x and y are parameters, and 3 and 5 are arguments
Since attributes are the name given to variables that are created within a class, you can think that everything within a class changes its name, therefore
Function, within a class is called Method
Variables, within a class is called Attributes
Hope this helps