Exam-style question
Try this first
What is printed by this Python 3 code? def get_number(): return 8 print(get_number() + 2).
- A.2
- B.8
- C.10
- D.get_number() + 2
Model answer
What a good answer should say
- 10
Explanation
Why this works
The call to get_number() is replaced by its returned value, 8. The expression therefore becomes 8 + 2, which prints 10.
Common mistake
No common mistake is linked to this question yet.
