0 votes
10 views

How will you create a dictionary in python?

in Technology by (189k points)

1 Answer

0 votes

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 (189k points)

Related questions

0 votes
1 answer 10 views
0 votes
1 answer 10 views
0 votes
1 answer 11 views
0 votes
1 answer 14 views
0 votes
1 answer 9 views
...