Home »
Python »
Python Dictionary MCQs
From the given syntax, which of the following is the correct syntax to create a dictionary?
6. From the given syntax, which of the following is the correct syntax to create a dictionary?
- Dict=[ 1:"hi",2:"hello"]
- Dict={ 1:"hi",2:"hello"}
- Dict={ 1:"hi",2:"hello"}
- Dict=[ 1:"hi",2:"hello"]
Answer: C) Dict={ 1:"hi",2:"hello"}
Explanation:
Dict={1:"hi",2:"hello"} is the correct syntax to create a dictionary, where 1 and 2 are the unique keys and HI and HELLO are the pairs.