PCEP-30-02 practice question 33 of 35

Consider the function below: def func(number, result=[]): result.append(number) return result We have a classic Python problem here. The default…

Choose your answer, then check it against the explanation.

Domain Functions and Exceptions

Consider the function below: def func(number, result=[]): result.append(number) return result We have a classic Python problem here. The default value for the result argument is a list (a mutable object). In Python, the default value of a function argument is only evaluated once. The function was called twice: func(10) func(20) Considering the above, what will be the result of the next call func(30)?
Answer options
Question 33 of 35

Keep practicing

Take the free PCEP-30-02 practice test

Ten exam-style questions with answers and explanations, plus the exam facts and study guides.

Start the free practice test

More questions

Other PCEP-30-02 practice questions

Scroll to Top