Q. Consider below given function headers. Identify which of these will cause error and why?
(i) def func(a = 1, b):
(ii) def func(a = 1, b, c = 2):
(iii) def func(a = 1, b = 1, c = 2):
(iv) def func (a = 1, b = 1, c = 2, d):
Answer :-
Function headers (i), (ii) and (iv) will cause error because non-default arguments cannot follow default arguments.
Only function header (ii) will not cause any error.
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )