MediumApplyPythonpredict_output
What is the output? ```python def f(x=[]): x.append(1) return x print(f()) print(f()) ```
Apply — Tests ability to use knowledge in practical scenarios.
Want to see the correct answer?
Get the answer with a detailed explanation, plus practice 32+ more Python questions with adaptive quizzes and timed interviews.
See the Answer on Guru Sishya →This question is from the Python topic (Programming Languages).
More Python Questions
What is the GIL and why does it matter for Python concurrency?
MediumWhat does `functools.wraps` do and why is it important in decorators?
Medium-EasyWhat is the difference between a generator and a list comprehension?
Medium-EasyImplement a decorator that caches function results (memoization) without using functools.lru_cache.
Medium-HardWhat is Python's MRO (Method Resolution Order) and how does Python compute it?
Medium-Hard