← Quiz: How AI Coding Assistants Work: all 10 questions
Quiz: How AI Coding Assistants Work · Question 9 of 10
What does this print? (code)
What does this print?
def average_marks(marks):
if not marks:
return 0.0
return sum(marks) / len(marks)
print(average_marks([]), average_marks([80, 90]))
- A.Error: division by zero
- B.0.0 85.0
- C.0 85
- D.None 85.0
Answer & explanation
Correct answer: 0.0 85.0
The guard for an empty list is the decision you, not the AI, must make.
Can you get the rest right without peeking?
Take the timed Quiz: How AI Coding Assistants Work quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →