← Quiz: How LLMs Work: all 10 questions
Quiz: How LLMs Work · Question 6 of 10
What does this print? (code)
What does this print?
from collections import Counter, defaultdict
words = "the exam is easy . the exam is long . the result is out".split()
following = defaultdict(Counter)
for current, nxt in zip(words, words[1:]):
following[current][nxt] += 1
print(following["the"].most_common(1)[0])
- A.('result', 1)
- B.('exam', 2)
- C.('is', 3)
- D.('the', 3)
Answer & explanation
Correct answer: ('exam', 2)
"exam" follows "the" twice and "result" once.
Can you get the rest right without peeking?
Take the timed Quiz: How LLMs Work quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →