What is correct syntax to create Python dictionary?

PythonServer Side ProgrammingProgramming

A Python dictionary object is a collection of key-value pairs. Each item in a dictionary consists of a value associated with key. The association is defined by putting : between them. Such key-value pairs, separated by comma and included within curly brackets, forms a dictionary object.

Key component of item must be an immutable object and unique in the collection. Value component may be repeated and can be of any data type.

>>> D1={"name":"Raaj", "age":23, "subjects":["Phy", "Che", "maths"],"GPA":8.5}
Published on 30-Dec-2017 23:11:13