The following code calls the call to print 10, but the reason for this is not knowing that any body please explain
DIF test (x = []): x.append (10) print x
This is called a default argument
& gt; & Gt; & Gt; Diff test (x = []): ... x.append (10) ... print x ... & gt; & Gt; & Gt; Test () [10] & gt; & Gt; & Gt; Test ([20]) [20, 10]
If the argument has not been passed during the function call, then specify the value to move. Therefore, if a value is found in the parameter If used, it is used. Otherwise, the default value is used.
Comments
Post a Comment