PCEP • Practice Test 5
Free PCEP practice test — 10 questions with explanations. Set 5. No signup required.
You are a developer on a team that maintains a legacy Python 2 codebase being migrated to Python 3. One function reads a file in text mode and counts word frequencies. In Python 2, the code used the dict.iteritems() method to iterate over the dictionary. After migration, the code raises AttributeError: 'dict' object has no attribute 'iteritems'. You need to update the code to work in Python 3 while minimizing changes. Which action should you take?
Choose an answer to begin — your selection is scored in the full session.
10 questions · instant feedback and full explanations after every question.