CBSE Class 12 Computer Science Question 42 of 120

Review of Python Basics — Question 16

Back to all questions
16
Question

Question 16

Which is the correct form of declaration of dictionary?

  1. Day = {1: 'monday', 2: 'tuesday', 3: 'wednesday'}
  2. Day = (1; 'monday', 2; ' tuesday', 3; 'wednesday')
  3. Day = [1: 'monday', 2: 'tuesday', 3: 'wednesday']
  4. Day = {1'monday', 2'tuesday', 3'wednesday']
Answer

Day = {1: 'monday', 2: 'tuesday', 3: 'wednesday'}

Reason — The syntax of dictionary declaration is:

<dictionary-name> = {<key>:<value>, <key>:<value>}

According to this syntax, Day = {1:'monday', 2:'tuesday', 3:'wednesday'} is the correct answer.