nerdexam
Python_Institute

PCAP-31-03 · Question #73

You need data which can act as a simple telephone directory. You can obtain it with the following clauses (choose two relevant variants; assume that no other items have been created before)

The correct answer is A. dir={'Mom':5551234567, 'Dad':5557654321> B. dir={'Mom':'5551234567', * Dad':'5557654321'}. Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'Mom' is not defined

Technology and architecture

Question

You need data which can act as a simple telephone directory. You can obtain it with the following clauses (choose two relevant variants; assume that no other items have been created before)

Options

  • Adir={'Mom':5551234567, 'Dad':5557654321>
  • Bdir={'Mom':'5551234567', * Dad':'5557654321'}
  • Cdir={Mom:5551234567, Dad:5557654321}
  • Ddir={Mom:'5551234567', Dad:'5557654321'}

How the community answered

(47 responses)
  • A
    79% (37)
  • C
    6% (3)
  • D
    15% (7)

Explanation

Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'Mom' is not defined

Topics

#Python dictionaries#dict syntax#data structures#key-value pairs

Community Discussion

No community discussion yet for this question.

Full PCAP-31-03 Practice