+ 1

What's the parameters in python ?

9th Jun 2017, 12:51 PM
Salah Ayoob
Salah Ayoob - avatar
2 Respuestas
+ 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
9th Jun 2017, 1:10 PM
LordHill
LordHill - avatar
+ 1
def func(x): return x+2 and then, a = 3 call function, func(a) x: parameters a: arguments
19th Jun 2017, 8:16 AM
Doan Ky An
Doan Ky An - avatar