0
How will you create a dictionary in python?

Open 1 Answers 22 Views Technology

How will you create a dictionary in python?

1 Answer

0

Dictionaries are enclosed by curly braces ({ }) and values can be assigned and accessed using square braces ([]).

dict = {}

dict['one'] = "This is one"

dict[2]     = "This is two"

tinydict = {'name': 'john','code':6734, 'dept': 'sales'}

by (274k points)
...