+ 1
What's the parameters in python ?
2 odpowiedzi
+ 2
def add(x,y):
print(x+y)
This is a function. the parameters are x and y. You pass them in when you call the function, like this
add(4,2)
That would make x=4 and y=2 in your function. so
add(4,2)
would output the print of x and y or 4 and 2.
output of add(4,2)
6
output of add(3,6)
9
+ 1
def func(x):
return x+2
and then,
a = 3
call function,
func(a)
x: parameters
a: arguments