Computer Science

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'}

Python Dictionaries

1 Like

Answer

Day = {1:'Monday', 2:'Tuesday', 3:'wednesday'}

Reason — The syntax of dictionary declaration is:

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

According this syntax, Day = {1:'Monday', 2:'Tuesday', 3:'wednesday'} is the correct answer.

Answered By

1 Like


Related Questions